How to Use PHP Frameworks
- 1). Right-click the PHP you want to use on your site that contains the framework and click "Open With." Click your preferred PHP editor.
- 2). Connect to the framework controller. You must tell your PHP engine that it needs to connect and use the PHP framework from the outside source. The following code connects to the "CakePHP" framework:
class HelloWorld extends Controller{
}
This class connects to the framework controller and the "HelloWorld" class inherits the framework. - 3). Create a function for the new class. Add the following function to the class to set up a framework method that prints "Hello World" to the browser:
function printHello(){
echo 'Hello, World!';
} - 4). Call the new class and function from your code. Now that the framework is included in your code, use the following code to run the function:
printHello();