PHP code example of phpfastcgi / slim-adapter

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


 // command.php

// Include the composer autoloader
PFastCGI\Adapter\Slim\AppWrapper;
use Slim\App;

// Create your Slim app
$app = new App();
$app->get('/hello/{name}', function ($request, $response, $args) {
    $response->write('Hello, ' . $args['name']);
    return $response;
});

// Create the kernel for the FastCGIDaemon library (from the Slim app)
$kernel = new AppWrapper($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