Skip to content

Commit 9fd66a8

Browse files
Update README.md
1 parent 6c8d3a2 commit 9fd66a8

1 file changed

Lines changed: 71 additions & 2 deletions

File tree

README.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,71 @@
1-
# ExpressiveAdapter
2-
A package that allows Zend Expressive applications to reduce overheads by running as a FastCGI daemon. http://phpfastcgi.github.io/
1+
# PHPFastCGI Zend Expressive Adapter
2+
3+
[![Latest Stable Version](https://poser.pugx.org/phpfastcgi/expressive-adapter/v/stable)](https://packagist.org/packages/phpfastcgi/expressive-adapter)
4+
[![Build Status](https://travis-ci.org/PHPFastCGI/ExpressiveAdapter.svg?branch=v0.5.0)](https://travis-ci.org/PHPFastCGI/ExpressiveAdapter)
5+
[![Coverage Status](https://coveralls.io/repos/PHPFastCGI/ExpressiveAdapter/badge.svg?branch=master&service=github)](https://coveralls.io/github/PHPFastCGI/ExpressiveAdapter?branch=master)
6+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/PHPFastCGI/ExpressiveAdapter/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PHPFastCGI/ExpressiveAdapter/?branch=master)
7+
[![Total Downloads](https://poser.pugx.org/phpfastcgi/expressive-adapter/downloads)](https://packagist.org/packages/phpfastcgi/expressive-adapter)
8+
9+
A PHP package which allows Zend Expressive applications to reduce overheads by exposing their Request-Response structure to a FastCGI daemon.
10+
11+
Visit the [project website](http://phpfastcgi.github.io/).
12+
13+
## Introduction
14+
15+
Using this package, Zend Expressive applications can stay alive between HTTP requests whilst operating behind the protection of a FastCGI enabled web server.
16+
17+
## Current Status
18+
19+
This project is currently in early stages of development and not considered stable. Importantly, this library currently lacks support for uploaded files.
20+
21+
Contributions and suggestions are welcome.
22+
23+
## Installing
24+
25+
```sh
26+
composer require "phpfastcgi/expressive-adapter:^0.1"
27+
```
28+
29+
## Usage
30+
31+
```php
32+
<?php // command.php
33+
34+
// Include the composer autoloader
35+
require_once dirname(__FILE__) . '/../vendor/autoload.php';
36+
37+
use PHPFastCGI\FastCGIDaemon\ApplicationFactory;
38+
use PHPFastCGI\Adapter\Expressive\AppWrapper;
39+
use Zend\Expressive\AppFactory;
40+
41+
// Create your Expressive app
42+
$app = AppFactory::create();
43+
$app->get('/', function ($request, $response, $next) {
44+
$response->getBody()->write('Hello, World!');
45+
return $response;
46+
});
47+
48+
// Create the kernel for the FastCGIDaemon library (from the Expressive app)
49+
$kernel = new AppWrapper($app);
50+
51+
// Create the symfony console application
52+
$consoleApplication = (new ApplicationFactory)->createApplication($kernel);
53+
54+
// Run the symfony console application
55+
$consoleApplication->run();
56+
```
57+
58+
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.
59+
60+
This can be done by creating a FastCGI script that launches your application and inserting a FastCgiServer directive into your virtual host configuration.
61+
62+
```sh
63+
#!/bin/bash
64+
php /path/to/command.php run
65+
```
66+
67+
```
68+
FastCgiServer /path/to/web/root/script.fcgi
69+
```
70+
71+
If you are using a web server such as nginx, you will need to use a process manager to monitor and run your application.

0 commit comments

Comments
 (0)