PHP code example of borschphp / application

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

    

borschphp / application example snippets


$container = new Container();
$container->set(PipePathMiddleware::class);
$container->set(RouteMiddleware::class);
$container->set(DispatchMiddleware::class);
$container->set(NotFoundHandlerMiddleware::class);
$container->set(TestHandler::class);
$container->set(FastRouteRouter::class);
$container->set(RouterInterface::class, FastRouteRouter::class)->cache(true);

$app = new App(
    new RequestHandler(),
    $container->get(RouterInterface::class),
    $container
);

$app->pipe(RouteMiddleware::class);
$app->pipe(DispatchMiddleware::class);
$app->pipe(NotFoundHandlerMiddleware::class);

$app->get('/a/get/path', TestHandler::class);

$app->run(ServerRequestFactory::fromGlobals());