2017 © Pedro Peláez
 

library http-app

Http version of the weew/app package.

image

weew/http-app

Http version of the weew/app package.

  • Wednesday, July 27, 2016
  • by weew
  • Repository
  • 1 Watchers
  • 0 Stars
  • 101 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 25 Versions
  • 0 % Grown

The README.md

Http App

Build Status Code Quality Test Coverage Version Licence, (*1)

Table of contents

Installation

composer require weew/http-app, (*2)

Introduction

This is a very minimalistic wrapper for a http application., (*3)

Usage

The whole app lifecycle is event based. To successfully handle http requests you must handle the HandleHttpRequestEvent and provide a valid response that implements the IHttpResponse interface., (*4)

Below is a very basic example of how you might implement this., (*5)

$app = new HttpApp();
$app->getEventer()
    ->subscribe(HandleHttpRequestEvent::class, function(HandleHttpRequestEvent $event) {
        $request = $event->getRequest();

        // handle request (do some routing, call a controller, etc.)
        // provide a response that implements the IHttpResponse interface
        $event->setResponse($response);
    });

There is already an existing implementation for this, see weew/http-app-request-handler., (*6)

Environment awareness

Sometimes you might want, for example during tests, to send a request to the same front controller but in a different environment. Symfony does this using different front controllers: app.php and app_dev.php. This approach will however alter the url and might not be suitable in some situations. Beside creating different front controllers you can also specify an environment using the x-env: dev header or a query param ?env=dev or a somewhere inside your url /env=dev/some/url. If an environment setting can be detected either via headers or url query or url part, the corresponding data (x-env header, env query param, env value inside the url) will be automatically removed. This feature is disabled by default and you can enable it by setting debug to true., (*7)

```php $app->setDebug(true); $request = new HttpRequest();, (*8)

$request->getHeaders()->set('x-env', 'stage'); // or $request->getUrl()->getQuery()->set('env', 'stage'); // or $request->getUrl()->setPath('/env=stage/some/url');, (*9)

// app will run in the "stage" environment $app->handle($request); ```, (*10)

You must not use this in production! This is why it is disabled by default. Only enable this feature for your dev environment., (*11)

Extensions

There are several extensions available:, (*12)

The Versions

27/07 2016

dev-master

9999999-dev

Http version of the weew/app package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

27/07 2016

v2.11.0

2.11.0.0

Http version of the weew/app package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

23/07 2016

v2.10.0

2.10.0.0

Http version of the weew/app package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

21/07 2016

v2.9.1

2.9.1.0

Http version of the weew/app package.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxim Kott

21/04 2016

v2.9.0

2.9.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

20/04 2016

v2.8.0

2.8.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

19/04 2016

v2.7.0

2.7.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

19/04 2016

v2.6.0

2.6.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

31/03 2016

v2.5.1

2.5.1.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

31/03 2016

v2.5.0

2.5.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^2.0
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

31/03 2016

v2.4.0

2.4.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.5
  • weew/php-http ^1.9

 

The Development Requires

by Maxim Kott

09/03 2016

v2.3.1

2.3.1.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

09/03 2016

v2.3.0

2.3.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

08/03 2016

v2.2.0

2.2.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

03/03 2016

v2.1.0

2.1.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

22/02 2016

v2.0.1

2.0.1.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

22/02 2016

v2.0.0

2.0.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

27/01 2016

v1.5.1

1.5.1.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

26/01 2016

v1.5.0

1.5.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.4

 

The Development Requires

by Maxim Kott

21/01 2016

v1.4.0

1.4.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott

21/01 2016

v1.3.0

1.3.0.0

Http version of the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott

14/01 2016

v1.2.0

1.2.0.0

Http extension for the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.2
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott

11/01 2016

v1.1.0

1.1.0.0

Http extension for the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.0
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott

11/01 2016

v1.0.1

1.0.1.0

Http extension for the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.0
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott

11/01 2016

v1.0.0

1.0.0.0

Http extension for the weew/php-app package.

  Sources   Download

MIT

The Requires

  • weew/php-app ^1.0
  • weew/php-http ^1.1

 

The Development Requires

by Maxim Kott