PHP code example of adrosoftware / lmrp-loader

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

    

adrosoftware / lmrp-loader example snippets




declare(strict_types=1);

// Delegate static file requests back to the PHP built-in webserver
if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) {
    return false;
}

chdir(dirname(__DIR__));
er.php';

    /** @var \Mezzio\Application $app */
    $app = $container->get(\Mezzio\Application::class);
    $factory = $container->get(\Mezzio\MiddlewareFactory::class);

    // Execute programmatic/declarative middleware pipeline and routing
    // configuration statements
    (

(

(new \AdroSoftware\Lmrp\Loader('config/routes.*.php'))->load($app, $factory, $container);

(new \AdroSoftware\Lmrp\Loader('config/routes.*.php'))->prefix($app, $factory, $container);

return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container): void

return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container, \AdroSoftware\Lmrp\Prefixer $prefixer = null): void 

// `routes.api.php`
return static function (Application $app, MiddlewareFactory $factory, ContainerInterface $container, \AdroSoftware\Lmrp\Prefixer $prefixer = null): void {
    $app->get('/api/', Api\Handler\HomeHandler::class, 'api.home');
    // or
    $prefixer->get('/', Api\Handler\HomeHandler::class, 'api.home');
};