PHP code example of phpfastcgi / silex-adapter

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


 // web/command.php

// Include the composer autoloader
tCGI\Adapter\Silex\ApplicationWrapper;
use Silex\Application;

// Create your Silex application
$app = new Application;
$app->get('/hello/{name}', function ($name) use ($app) {
    return 'Hello ' . $app->escape($name);
});

// Create the kernel for the FastCGIDaemon library (from the Silex application)
$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/silex/web/command.php run
sh
php /path/to/command.php run --port=5000 --host=localhost