Skip to content

Commit 6a8c657

Browse files
author
Andrew Carter
committed
Documented changes in application-factory branch
1 parent cc365ab commit 6a8c657

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

README.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,20 @@ Below is an example of a simple 'Hello, World!' FastCGI application in PHP.
2727
// Include the composer autoloader
2828
require_once dirname(__FILE__) . '/../vendor/autoload.php';
2929

30-
use PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand;
31-
use PHPFastCGI\FastCGIDaemon\DaemonFactory;
30+
use PHPFastCGI\FastCGIDaemon\ApplicationFactory;
3231
use Psr\Http\Message\ServerRequestInterface;
33-
use Symfony\Component\Console\Application;
3432
use Zend\Diactoros\Response\HtmlResponse;
3533

36-
// Create the dependencies for the DaemonRunCommand
37-
38-
// Dependency 1: The daemon factory
39-
$daemonFactory = new DaemonFactory();
40-
41-
// Dependency 2: A simple kernel. This is the core of your application
34+
// A simple kernel. This is the core of your application
4235
$kernel = function (ServerRequestInterface $request) {
4336
return new HtmlResponse('<h1>Hello, World!</h1>');
4437
};
4538

46-
// Create an instance of DaemonRunCommand using the daemon factory and the kernel
47-
$command = new DaemonRunCommand('run', 'Run a FastCGI daemon', $daemonFactory, $kernel);
48-
49-
// Create a symfony console application and add the command
50-
$consoleApplication = new Application();
51-
$consoleApplication->add($command);
39+
// Create your Symfony console application using the factory
40+
$application = (new ApplicationFactory)->createApplication($kernel);
5241

53-
// Run the symfony console application
54-
$consoleApplication->run();
42+
// Run the Symfony console application
43+
$application->run();
5544
```
5645

5746
If you wish to configure your FastCGI application to work with the apache web server, you can use the apache FastCGI module to process manage your application.

0 commit comments

Comments
 (0)