@@ -20,30 +20,21 @@ Using this package, Silex applications can stay alive between HTTP requests whil
20
20
// Include the composer autoloader
21
21
require_once dirname(__FILE__) . '/../vendor/autoload.php';
22
22
23
- use PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand;
24
- use PHPFastCGI\FastCGIDaemon\DaemonFactory;
23
+ use PHPFastCGI\FastCGIDaemon\ApplicationFactory;
25
24
use PHPFastCGI\Speedex\ApplicationWrapper;
26
25
use Silex\Application as SilexApplication;
27
- use Symfony\Component\Console\Application as ConsoleApplication;
28
26
29
27
// Create your Silex application
30
28
$app = new SilexApplication;
31
29
$app->get('/hello/{name}', function ($name) use ($app) {
32
30
return 'Hello ' . $app->escape($name);
33
31
});
34
32
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)
39
34
$kernel = new ApplicationWrapper($app);
40
35
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);
47
38
48
39
// Run the symfony console application
49
40
$consoleApplication->run();
0 commit comments