PHP code example of phpfastcgi / expressive-adapter

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

    

phpfastcgi / expressive-adapter example snippets


 // command.php

// Include the composer autoloader
PFastCGI\Adapter\Expressive\ApplicationWrapper;
use Zend\Expressive\AppFactory;

// Create your Expressive app
$app = AppFactory::create();
$app->get('/', function ($request, $response, $next) {
    $response->getBody()->write('Hello, World!');
    return $response;
});

// Create the kernel for the FastCGIDaemon library (from the Expressive app)
$kernel = new ApplicationWrapper($app);

// Create the symfony console application
$consoleApplication = (new ApplicationFactory)->createApplication($kernel);

// Run the symfony console application
$consoleApplication->run();
sh
#!/bin/bash
php /path/to/command.php run
sh
php /path/to/command.php run --port=5000 --host=localhost