Announcing Adrenaline v0.1.0
This blog post was published more than one year ago and might be outdated!
· One min read
In the course of polishing the Adroit v.0.4.0 release we realized that it would totally make sense to turn Adroit into an own separate (micro) web framework to be able to set up projects quickly. Whilst the focus of Adroit was to provide a PSR-7 compatible middleware for ADR we came up with the idea to create a separate package which we named Adrenaline.
The fastest way to get started with Adrenaline is using it in what we call the "prototype" mode, simply define your routes and action callbacks like this:
use bitExpert\Adrenaline\Adrenaline;
use Zend\Diactoros\ServerRequestFactory;
use Zend\Diactoros\Response;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
$adrenaline = new Adrenaline();
$adrenaline->get('home', '/', function (ServerRequestInterface $request,
ResponseInterface $response) {
$response->getBody()->rewind();
$response->getBody()->write('Home');
return $response;
});
$request = ServerRequestFactory::fromGlobals();
$response = new Response();
$adrenaline($request, $response);
Since Adrenaline extends Adroit you can use the same methods to configure your ActionResolver or ResponderResolver as you do in Adroit. This seems to be ideal for "bigger" applications where you want to enforce a certain project structure.