PHP code example of stratify / framework

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

    

stratify / framework example snippets




use Stratify\ErrorHandlerModule\ErrorHandlerMiddleware;
use Stratify\Framework\Application;
use Zend\Diactoros\Response\HtmlResponse;
use function Stratify\Framework\pipe;
use function Stratify\Framework\router;

::class,
    
    // The application's router
    // See https://github.com/stratifyphp/router for more details
    router([
        // Routes
        '/' => function () {
            return new HtmlResponse('Welcome!');
        },
        '/about' => function () {
            return new HtmlResponse('More information about us');
        },
    ]),
]);

// List of packages containing PHP-DI config to 

$modules = [
    'stratify/error-handler-module',
    'app',
];

return [
    ...

    'twig.paths' => [
        // Configure the directory using the alias `app`
        // In this example views are stored in the `res/views/` directory
        // You can then use the `@app/...` notation to render or 

$http = pipe([
    ErrorHandlerMiddleware::class,
    router([
        // Routes
        '/' => function (Twig_Environment $twig) {
            return $twig->render('@app/home.twig');
        },
    ]),
]);