Splash now supports StackPHP Middlewares
Starting with Splash 5, Splash (Mouf's MVC framework) is gaining support for StackPHP HTTP middlewares!
This means you can now add any of the great middlewares referenced on StackPHP's website directly in your Mouf application.
And because dependency injection is done graphically in Mouf, you can actually drag'n'drop middlewares to create your middleware's stack. Have a look at the call stack displayed graphically in your 'splash' instance. It just makes sense :)
Also, the Splash router and Splash error handling are now middlewares too, and there will soon be more to come!
In related news, controllers written using Splash 5+ can now return Symfony 2 Response
objects, so you can now write things like:
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
class MyController extends Controller {
/**
* Returning a Response object
*
* @URL /myurl1
*/
public function test() {
return new Response('Hello World', 200, array('content-type' => 'text/html'));
}
/**
* Returning a JSON response
*
* @URL /myjsonurl
*/
public function testJson() {
return new JsonResponse({ "status" => "ok", "message" => "Hello world!" });
}
}
Hope you will enjoy these changes!
- david's blog
- Log in to post comments
What’s new on Mouf :
- TDBM 5.0 is released 09/11/2017
- Quickstarting a Mouf appl... 15/06/2017
- Building beautiful datagr... 05/10/2016
- Official release of TDBM... 14/06/2016
- Announcing Mouf 2.1 first... 01/03/2016
- Mouf + Magento + PSR-7 =... 30/06/2015
- Standardizing the way we... 10/06/2015
- Container interoperabilit... 09/06/2015
- Container-interop + PSR7... 01/06/2015
- New in Mouf: a console! 19/05/2015