Download the PHP package free-elephants/rest-daemon without Composer
On this page you can find all versions of the php package free-elephants/rest-daemon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download free-elephants/rest-daemon
More information about free-elephants/rest-daemon
Files in free-elephants/rest-daemon
Package rest-daemon
Short Description PHP http socket REST server
License BSD-2-Clause
Informations about the package rest-daemon
Rest-Daemon
Nota Bene: This project uses semver and changelog. But it's not a stable major version. Any minor update (f.e. 0.5. -> 0.6.) can break backward compatibility!
Simple PHP7 framework for fast building REST services based on middleware, PSR-7 and react.
Runned instance can be found by link, also see example repo.
Features:
- Middleware oriented request/response handling
- Priority PSR's support: PSR-2, -3, -4, -7, -11, -15 and other.
- Built-in Middleware to support usual REST features, like HTTP based semantics, content types, request parsing, headers.
- Choose one of two available http-daemon drivers: Ratchet ReactPHP or Aerys.
- Swagger Integration
Installation
$ composer require free-elephants/rest-daemon
Usage
See example in example/rest-server.php and documentation.
Create and Run Server:
Add Your RESTful API Endpoints
Any endpoint method handler can be Middleware-like callable implementation: function or class with __invoke() method.
See how to build server for step by step in one script
RestServerBuilder
You can use php-di (or another PSR-11 container implementation) and routing file configuration with RestServerBuilder for more configuring and coding less.
See example with file based rest-server.php
Routing
You can link with every method in route a handler, and optionally organize routes by modules. By default server contain 1 default module for all endpoints. See example: routes.php
Configure Common Application Middleware
By default server instance provide collection with some useful middleware. You can extend or override it:
Every endpoint's method handler will be wrapped to this collection and called between defined as after
and before
middleware.
Also you can configure default middleware collection with access to every built-in middleware by key: this collection implements ArrayAccess interface.
Customize Endpoint Middleware
... Will be implemented...
Debugging and Logging
... Will be implemented...
All versions of rest-daemon with dependencies
cboden/ratchet Version 0.4
free-elephants/di Version ^2.0
guzzlehttp/psr7 Version ^1.0
monolog/monolog Version ^1.21
oscarotero/psr7-middlewares Version ^3.18
psr/container Version ^1.0
relay/middleware Version ^1.1
relay/relay Version ~1.0
symfony/routing Version ^3.1
zendframework/zend-code Version ^3.1
zendframework/zend-diactoros Version ^1.3
zendframework/zend-http Version ^2.5
zircote/swagger-php Version ^2.0
psr/log Version ^1.0
symfony/console Version ^4.2