koine / http
Http objects for handling requests and responses
0.9.3
2014-09-23 20:43 UTC
Requires
- php: >=5.3.3
- koine/core: 0.9.*
- koine/strong-parameters: 0.9.*
Requires (Dev)
- phpunit/phpunit: *
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-11-09 16:53:18 UTC
README
Work in progress Http models
Code information:
Package information:
Usage
namespace Koine\Http; $env = new Environment($_SERVER); $cookies = new Cookies($_COOKIE); $session = new Session($_SESSION); $params = new Params($_REQUEST); $request = new Request(array( 'environment' => $env, 'cookies' => $cookies, 'session' => $session, 'params' => $params, )); $hello = function ($request) { $response = new Response(array( 'cookies' => $cookies, )); return $response->setBody('Hello Word!'); }; // If page is hello $hello()->send(); $redirect = function ($request) { $response = new Response(array( 'cookies' => $cookies, )); return $response->setRedirect('/'); }; // If page is redirect $redirect()->send();
Installing
Via Composer
Append the lib to your requirements key in your composer.json.
{ // composer.json // [..] require: { // append this line to your requirements "koine/http": "dev-master" } }
Alternative install
- Learn composer. You should not be looking for an alternative install. It is worth the time. Trust me ;-)
- Follow this set of instructions
Issues/Features proposals
Here is the issue tracker.
Contributing
Only TDD code will be accepted. Please follow the PSR-2 code standard.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
How to run the tests:
phpunit --configuration tests/phpunit.xml
To check the code standard run:
phpcs --standard=PSR2 lib phpcs --standard=PSR2 tests