Download the PHP package bitexpert/adrenaline without Composer
On this page you can find all versions of the php package bitexpert/adrenaline. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bitexpert/adrenaline
More information about bitexpert/adrenaline
Files in bitexpert/adrenaline
Package adrenaline
Short Description A PSR-7 micro framework built on top of the Adroit middleware.
License Apache-2.0
Informations about the package adrenaline
bitexpert/adrenaline
A PSR-7 micro framework built on top of the Adroit middleware to speed up your development ;)
- Getting started
- How to configure action resolvers
- How to configure responder resolvers
- How to configure routing
- How to implement an action
- How to implement a responder
- How to use the middleware hooks
- How to use an error handler
- How to integrate with a DI container
- License
Getting started
The preferred way of installing bitexpert/adrenaline
is through Composer. Simply add bitexpert/adrenaline
as a dependency:
Prototyping
If you want to use Adrenaline for fast prototyping you proceed as follows:
- Create an index.php in your application's root directory.
-
Add the following lines to it:
- Start a server by using php -S localhost:8082 inside the same directoy.
- Browse to http://localhost:8082 and you should see "Home" on the screen.
So that's the basic setup. You may add more actions by using the implicit routing functions of Adrenaline and of course you may use middleware hooks, error handler and custom resolvers just as you would do in a productive application. This is just a possibility to give you a quick result for prototyping.
How to configure action resolvers
You may configure custom action resolvers for Adrenaline. By default bitexpert/adroit
's CallableActionResolver
is added if no action resolvers are provided with the constructor which allows you to use simple Closures as actions (e.g. for protoyping case)
Be aware that you have to add this resolver explicitly if you define your own set of action resolvers if you still want to use it.
How to configure responder resolvers
You may configure custom action resolvers for Adrenaline. By default bitexpert/adroit
's CallableResponderResolver
is added if no responder resolvers are provided with the constructor which allows you to use simple Closures as responders (e.g. for protoyping case)
Be aware that you have to add this resolver explicitly if you define your own set of responder resolvers if you still want to use it.
How to configure routing
With Adrenaline you may also use custom routers. Your custom router needs to inherit bitexpert/pathfinder
's
Router interface.
If you want to use a custom route class within the implicit route creation functions (get, post, etc.) you can set the custom route route class:
For standard route definition, please have a look at the pathfinder docs.
How to implement an action
See bitexpert/adroit
docs.
How to implement a responder
See bitexpert/adroit
docs.
How to use the middleware hooks
Adrenaline offers the possibility to integrate your middlewares into the default processing of a request by using the provided middleware hooks:
These hooks are chainable and you may call them multiple times. Each call will push the provided middleware to the according stack. As middlewares you may either use a simple closures or use your own dedicated classes implementing the __invoke method with the according signature.
How to use an error handler
You also may define an error handler which will be used for uncaught errors occuring while Adrenaline processes the request. You may either use a simple closure or implement your own dedicated class for error handling. UPDATE Since update to Stratigility 1.3 (we use MiddelwarePipe internally) we had to change the errorhandling due to deprecation warnings. Nevertheless we made the old configuration style working due to backwards compatibility:
We recommend to use the new errorhandling since using the "old" error handler may become deprecated in adrenaline also after a while:
For further information please have a look at: https://docs.zendframework.com/zend-stratigility/migration/to-v2/#error-handling
How to integrate with a DI container
If you want to use a DI container, you may use the according resolvers to make use of it:
For further instructions you may also have a look at the bitexpert/adroit
docs.
License
Adrenaline is released under the Apache 2.0 license.
All versions of adrenaline with dependencies
bitexpert/pathfinder Version ^0.5.0
bitexpert/slf4psrlog Version ^0.1.0
zendframework/zend-diactoros Version ^1.0.0
psr/http-message Version ^1.0
willdurand/negotiation Version ^2.0
twig/twig Version ^1.24
bitexpert/adroit Version ^0.7.0
fig/http-message-util Version ^1.1