tuum / respond
helpers and responders for PSR7 http/messages.
Requires
- aura/session: ~2.0
- psr/container: ^1.0
- psr/http-message: ~1.0
- tuum/form: ^1.0
- willdurand/negotiation: ^2.0
Requires (Dev)
- koriym/printo: ~1.0
- league/plates: 3.*
- tuum/filemap: ^1.0
- zendframework/zend-diactoros: ~1.0
- 4.x-dev
- 3.x-dev
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 3.0.0-b4
- 3.0.0-b3
- 3.0.0-b2
- 3.0.0-b1
- 2.x-dev
- 2.0.0-RC2
- 2.0.0-RC1
- 1.x-dev
- 1.1.0
- 1.0.0
- 1.0.0-RC2
- 1.0.0-RC1
- 1.0.0beta4
- 1.0.0beta3
- 1.0.0beta2
- 1.0.0beta1
- 0.2.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-feature/session-in-request
- dev-feature/docs4x
- dev-feature/builder2container
- dev-feature/psr-17
- dev-feature/payload-in-request
- dev-master
This package is auto-updated.
Last update: 2024-10-28 17:33:24 UTC
README
Tuum/Respond
is a framework agnostic PHP module to
help construct a PSR-7 response object, and more.
It provides MVC's "View" functionality as shown in the figure below.
In this figure, the Controller part is managed by the framework
and Tuum/Respond
composes a respond object for views
(using template), error pages, and redirects.
$app->add('/', function (ServerRequestInterface $request, ResponseInterface $response) use ($responder) { return $responder->view($request, $response) ->setSuccess('welcome!') ->render('index'); });
License
- MIT license
PSR
- PSR-1, PSR-2, PSR-4, and PSR-7.
Who needs Tuum/Respond
?
Micro frameworks with middleware are very simple yet gives a great power on building a web application, but may not provide some useful features such as,
- carries flash messages and csrf token to templates,
- easily handles input values and validation errors,
- standard error templates,
With Tuum/Respond, it will be very easy to implement:
- Post-Redirect-Get pattern,
- use of object as Presenter (or ViewModel),
- filling input values in forms after validation error.
Installation
Installation and Demo Site
Please use the composer to install Tuum/Respond
;
$ composer require "tuum/respond:^3.0"
Demo
The repository includes a demo site to demonstrate what Tuum/Respond can do. To see the demo site;
- run
composer install
, - change directory to
/public
, - run
php -S localhost:8000 index.php
, and - access
localhost:8000
via browser.
Demo with Slim3
There is a demo with Slim3 framework, slim-tuum repository, for more realistic demo.