PHP code example of species / app

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

    

species / app example snippets


 

use function DI\add;
use Species\App\Middleware;

return [
    'settings.middleware' => add([
        Middleware\TwigDebugMiddleware::class,
        Middleware\CsrfValidationMiddleware::class,
        Middleware\AddRouteNameToTwigMiddleware::class,
        // ...
    ]),
];

 

use function DI\add;
use Slim\HttpCache\Cache as HttpCacheMiddleWare;

return [
    // Default settings
    'settings.httpCache.type' => 'private',
    'settings.httpCache.maxAge' => 86400,
    'settings.httpCache.mustRevalidate' => false,

    // Add middleware  
    'settings.middleware' => add([
        HttpCacheMiddleWare::class,
    ]),
];

 

use function DI\add;
use Species\App\TwigExtension;

return [
    // Twig globals
    'settings.twig.globals' => add([
        'foo' => 'bar',
        // ...
    ]),
    
    // Twig extensions
    'settings.twig.extensions' => add([
        TwigExtension\CsrfTwigExtension::class,
        TwigExtension\ReflectionTwigExtension::class,
        TwigExtension\RouterTwigExtension::class,
        // ...
    ]),
];