2017 © Pedro Peláez
 

library ieu_http

Lib for handling http requests and responses

image

stg/ieu_http

Lib for handling http requests and responses

  • Wednesday, July 12, 2017
  • by inceddy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 59 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

HTTP framework components

Request

Object representing a HTTP request., (*1)

Response

Object representing a HTTP response., (*2)

JsonResponse

Response transporting JSON encoded content., (*3)

RedirectResponse

Response using redirect header and meta-refresh., (*4)

Router

Routes request to the responsible handler., (*5)

Route

URL path description, including variables, variable validation and wildcardpattern., (*6)

Usage

// {id} matches didgits of all length
$route1a = (new Route('/path/to/user/{id}'))
    ->validate('id', '\d+');

// or shorthand

$route1b = (new Route('/path/to/user/{id|\d+}'));

// {everything} matches all allowed chars.
$route2 = new Route('/path/to/{everything}/update');

// Will match every route beginning with /path/to/
$route3 = new Route('/path/to/*')

RouterProvider

For the use in ieu\Container\Container dependency containers. Implements the same interface as Router. Handlers used in RouterProvider::then-method have access to all dependencies known to the container and additional to Request (the current request) and RouteParameter (all variables found in the route pattern)., (*7)

Usage


// ieu\Container (new ieu\Container\Container) ->provider('Router', new ieu\Http\RouterProvier) ->config(['RouterProvider', function($routerProvider){ $routerProvider ->get('/home', ['Request', 'RouteParameter', function($request, $parameter){ return new Response('This is the homepage '); }) ->otherwise(['Request', 'Error', function($request, $error) { // handle error }); }]); // ieu\App (new ieu\App) ->config(['RouterProvider', function($routerProvider){ $routerProvider ->get('/home', ['Request', 'RouteParameter', function($request, $parameter){ return new Response('This is the homepage '); }); }]);

The Versions

12/07 2017

dev-master

9999999-dev

Lib for handling http requests and responses

  Sources   Download

MIT

The Development Requires

by Philipp Steingrebe

12/07 2017

2.0.3

2.0.3.0

Lib for handling http requests and responses

  Sources   Download

MIT

The Development Requires

by Philipp Steingrebe

20/06 2017

2.0.1

2.0.1.0

Lib for handling http requests and responses

  Sources   Download

MIT

The Development Requires

by Philipp Steingrebe

09/06 2017

2.0.0

2.0.0.0

Lib for handling http requests and responses

  Sources   Download

MIT

The Development Requires

by Philipp Steingrebe

23/03 2017

dev-version_1

dev-version_1

ieUtilities - HTTP

  Sources   Download

MIT

by Philipp Steingrebe

23/03 2017

1.0

1.0.0.0

ieUtilities - HTTP

  Sources   Download

MIT

by Philipp Steingrebe