Add functions to modify cookies to response class
Currently there is no AppFramework way to modify cookies, which makes it unusable for quite some use-cases or results in untestable code. This PR adds some basic functionalities to add and invalidate cookies. Usage: ```php $response = new TemplateResponse(...); $response->addCookie('foo', 'bar'); $response->invalidateCookie('foo'); $response->addCookie('bar', 'foo', new \DateTime('2015-01-01 00:00')); ``` Existing cookies can be accessed with the AppFramework using `$this->request->getCookie($name)`.
Showing
- lib/private/appframework/app.php 9 additions, 1 deletionlib/private/appframework/app.php
- lib/private/appframework/http/dispatcher.php 5 additions, 3 deletionslib/private/appframework/http/dispatcher.php
- lib/public/appframework/http/response.php 68 additions, 5 deletionslib/public/appframework/http/response.php
- tests/lib/appframework/AppTest.php 1 addition, 1 deletiontests/lib/appframework/AppTest.php
- tests/lib/appframework/http/DispatcherTest.php 8 additions, 8 deletionstests/lib/appframework/http/DispatcherTest.php
- tests/lib/appframework/http/ResponseTest.php 86 additions, 0 deletionstests/lib/appframework/http/ResponseTest.php
Loading
Please register or sign in to comment