PHP code example of fernandopetry / mvc

1. Go to this page and download the library: Download fernandopetry/mvc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fernandopetry / mvc example snippets



use \Petry\MVC\Uri\Parse;
use \Petry\MVC\Uri\Param;
use \Petry\MVC\Uri\GetByURI;

$uri = new GetByURI('router');
$param = new Param($uri);
$parse = new Parse($param);

$parse->getController(); // Controller
$parse->getAction(); // Action
$parse->getParams(); // Params


use \Petry\MVC\Uri\UriFacade;

$facade = new UriFacade('router');
$facade->getController(); // Controller
$facade->getAction(); // Action
$facade->getParams(); // Params



use \Petry\MVC\Uri\UriFacade;

try {
    $factory = new \Petry\MVC\Controller\ControllerFactory(new UriFacade('router'),'Petry\Test\Controller');
    $factory->factory();
}catch (Exception $e){
    echo $e->getMessage();
}