2017 © Pedro Peláez
 

library fastcgi

The Hoa\Fastcgi library.

image

hoa/fastcgi

The Hoa\Fastcgi library.

  • Friday, October 20, 2017
  • by Hoa
  • Repository
  • 14 Watchers
  • 18 Stars
  • 10,515 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 8 Forks
  • 0 Open issues
  • 13 Versions
  • 28 % Grown

The README.md

Hoa , (*1)


Build status Code coverage Packagist License , (*2)

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds. , (*3)

Hoa\Fastcgi

Help on IRC Help on Gitter Documentation Board, (*4)

This library allows to manipulate the FastCGI protocol, which ensures the communication between a HTTP server and an external program (such as PHP)., (*5)

Learn more., (*6)

Installation

With Composer, to include this library into your dependencies, you need to require hoa/fastcgi:, (*7)

$ composer require hoa/fastcgi '~3.0'

For more installation procedures, please read the Source page., (*8)

Testing

Before running the test suites, the development dependencies must be installed:, (*9)

$ composer install

Then, to run all the test suites:, (*10)

$ vendor/bin/hoa test:run

For more information, please read the contributor guide., (*11)

Quick usage

As a quick overview, we propose to execute a PHP file through the FastCGI protocol directly., (*12)

Before starting, we need to know that PHP proposes two tools that support FastCGI: php-cgi and php-fpm (for FastCGI Process Manager). We will use php-cgi in local with the standard port 9000 in TCP:, (*13)

$ php-cgi -b 127.0.0.1:9000

First, we write the Echo.php file, the one we are likely to execute:, (*14)

<?php

echo 'foobar';

Second, we need to open a connexion to the FastCGI server and send a query with the following headers:, (*15)

  • SCRIPT_FILENAME which represents the absolute path to the PHP file to execute;
  • REQUEST_METHOD which represents the HTTP method among GET, POST, PUT, DELETE etc.;
  • REQUEST_URI which represents the identifier of the resource we are trying to access.

Thus:, (*16)

$fastcgi = new Hoa\Fastcgi\Responder(
    new Hoa\Socket\Client('tcp://127.0.0.1:9000')
);
var_dump($fastcgi->send([
    'REQUEST_METHOD'  => 'GET',
    'REQUEST_URI'     => '/',
    'SCRIPT_FILENAME' => __DIR__ . DS . 'Echo.php'
]));
// string(6) "foobar"

We can get the headers from the executed file by calling the Hoa\Fastcgi\Responder::getResponseHeaders method., (*17)

This is a good and fast way to execute PHP files (or other programs that support FastCGI) without worrying about binary locations, subshell calls, error handling, etc., (*18)

Documentation

The hack book of Hoa\Fastcgi contains detailed information about how to use this library and how it works., (*19)

To generate the documentation locally, execute the following commands:, (*20)

$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open

More documentation can be found on the project's website: hoa-project.net., (*21)

Getting help

There are mainly two ways to get help:, (*22)

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know., (*23)

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details., (*24)

The Versions

20/10 2017

dev-master

9999999-dev https://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

10/01 2017

3.17.01.10

3.17.01.10 https://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

11/01 2016

3.16.01.11

3.16.01.11 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

09/11 2015

2.15.11.09

2.15.11.09 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

29/05 2015

2.15.05.29

2.15.05.29 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

16/04 2015

2.15.04.16

2.15.04.16 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

19/02 2015

2.15.02.19

2.15.02.19 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

09/12 2014

2.14.12.10

2.14.12.10 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

25/11 2014

2.14.11.26

2.14.11.26 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library cgi fastcgi

13/11 2014

2.14.11.15

2.14.11.15 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

library cgi fastcgi

23/09 2014

2.14.09.23

2.14.09.23 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

library cgi fastcgi

17/09 2014

2.14.09.17

2.14.09.17 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

library cgi fastcgi

16/09 2014

1.14.09.16

1.14.09.16 http://hoa-project.net/

The Hoa\Fastcgi library.

  Sources   Download

BSD-3-Clause

The Requires

 

library cgi fastcgi