@@ -20,30 +20,21 @@ Using this package, Silex applications can stay alive between HTTP requests whil
2020// Include the composer autoloader
2121require_once dirname(__FILE__) . '/../vendor/autoload.php';
2222
23- use PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand;
24- use PHPFastCGI\FastCGIDaemon\DaemonFactory;
23+ use PHPFastCGI\FastCGIDaemon\ApplicationFactory;
2524use PHPFastCGI\Speedex\ApplicationWrapper;
2625use Silex\Application as SilexApplication;
27- use Symfony\Component\Console\Application as ConsoleApplication;
2826
2927// Create your Silex application
3028$app = new SilexApplication;
3129$app->get('/hello/{name}', function ($name) use ($app) {
3230 return 'Hello ' . $app->escape($name);
3331});
3432
35- // Dependency 1: The daemon factory
36- $daemonFactory = new DaemonFactory;
37-
38- // Dependency 2: A kernel for the FastCGIDaemon library (from the Silex application)
33+ // Create the kernel for the FastCGIDaemon library (from the Silex application)
3934$kernel = new ApplicationWrapper($app);
4035
41- // Create an instance of DaemonRunCommand using the daemon factory and the kernel
42- $command = new DaemonRunCommand('run', 'Run a FastCGI daemon', $daemonFactory, $kernel);
43-
44- // Create a symfony console application and add the command
45- $consoleApplication = new ConsoleApplication;
46- $consoleApplication->add($command);
36+ // Create the symfony console application
37+ $consoleApplication = (new ApplicationFactory)->createApplication($kernel);
4738
4839// Run the symfony console application
4940$consoleApplication->run();
0 commit comments