PHP code example of clagiordano / weblibs-mvc

1. Go to this page and download the library: Download clagiordano/weblibs-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/ */

    

clagiordano / weblibs-mvc example snippets


/**
 * Composer autoload
 */
ses
 */
use clagiordano\weblibs\mvc\Application;
use clagiordano\weblibs\mvc\Registry;
use clagiordano\weblibs\mvc\Router;
use clagiordano\weblibs\mvc\Template;

/**
 * Init base application
 * @var Application $application
 */
$application = new Application();

/**
 * Router setup
 */
$application->setRouter(
    new Router($application)
);

/**
 * set the path to the controllers directory
 */
$application->getRouter()->setControllersPath(
    __DIR__ . '/controllers'
);

/**
 * Template setup
 */
$application->setTemplate(
    new Template($application)
);

/**
 * load the controller / run the application
 */
$application->getRouter()->loader();
apacheconf
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]