PHP code example of lucinda / console-mvc

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

    

lucinda / console-mvc example snippets


$handler = new FrontController("configuration.xml", new MyCustomAttributes("application/event_listeners");
$handler->run();

$handler = new FrontController("stdout.xml", new FrameworkAttributes();
$handler->addEventListener(EventType::APPLICATION, Lucinda\Project\EventListeners\Logging::class);
$handler->run();

$controller = new Lucinda\ConsoleSTDOUT\FrontController("configuration.xml", new Attributes("application/events"));
// TODO: add event listeners here
$controller->run();

class StartBenchmark extends Lucinda\ConsoleSTDOUT\EventListeners\Start
{
    public function run(): void
    {
        // you will first need to extend Application and add: setStartTime, getStartTime
        $this->attributes->setStartTime(microtime(true));
    }
}

class EndBenchmark extends Lucinda\ConsoleSTDOUT\EventListeners\End
{
    public function run(): void
    {
        $benchmark = new Benchmark();
        $benchmark->save($this->attributes->getStartTime(), microtime(true));
    }
}

$parameters = $this->request->parameters();
console
php index.php ROUTE PARAM1 PARAM2 ...
console
php index.php ROUTE PARAM1 PARAM2 ...
console
php index.php ROUTE PARAM1 PARAM2 ...
console
php index.php users hello world