PHP code example of chubbyphp / chubbyphp-slim-psr15

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

    

chubbyphp / chubbyphp-slim-psr15 example snippets




declare(strict_types=1);

namespace App;

use App\Middleware\Psr15Middleware;
use Chubbyphp\SlimPsr15\MiddlewareAdapter;
use Slim\App;

$app = new App();
$app->add(new MiddlewareAdapter(new Psr15Middleware()));



declare(strict_types=1);

namespace App;

use App\Middleware\Psr15Middleware;
use Chubbyphp\SlimPsr15\LazyMiddlewareAdapter;
use Psr\Container\ContainerInterface;
use Slim\App;

/** @var ContainerInterface $container */
$container = ...;

$app = new App();
$app->add(new LazyMiddlewareAdapter($container, Psr15Middleware::class));



declare(strict_types=1);

namespace App;

use App\RequestHandler\Psr15RequestHandler;
use Chubbyphp\SlimPsr15\RequestHandlerAdapter;
use Slim\App;

$app = new App();
$app->get('/', new RequestHandlerAdapter(new Psr15RequestHandler()));



declare(strict_types=1);

namespace App;

use App\RequestHandler\Psr15RequestHandler;
use Chubbyphp\SlimPsr15\LazyRequestHandlerAdapter;
use Psr\Container\ContainerInterface;
use Slim\App;

/** @var ContainerInterface $container */
$container = ...;

$app = new App();
$app->get('/', new LazyRequestHandlerAdapter($container, Psr15RequestHandler::class));