PHP code example of designcise / bitframe

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

    

designcise / bitframe example snippets




\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use BitFrame\App;
use BitFrame\Emitter\SapiEmitter;

// 1. Instantiate the App
$app = new App();

$middleware = function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
    $response = $handler->handle($request);
    $response->getBody()->write('Hello World!');
    return $response;
};

// 2. Add middleware
$app->use([
    SapiEmitter::class,
    $middleware,
]);

// 3. Run the application
$app->run();