jimdo / http
This package is abandoned and no longer maintained.
No replacement package was suggested.
Library of Http Clients
v0.1.7
2017-05-26 12:58 UTC
Requires (Dev)
- phpunit/phpunit: ^5.4
README
php-http-lib
This repository is a library of http clients - Response, Request and Session.
Makefile
The library code provides a Makefile:
$ make help
bootstrap Install composer
update Update composer packages
tests Execute test suite
Download
$ https://packagist.org/packages/jimdo/http
$ composer require jimdo/http
Developement setup
# Clone the repository
$ git clone git@github.com:Jimdo/php-http-lib.git
# Install composer and project dependencies
$ make bootstrap
# Requirements for test-driven
$ (xDebug) phpbrew ext install xdebug
Useful methods in the Request
Object
- __construct(queryParams, formData, sessionData) - The construct is the field where the query params and form data need to fill in as an array. The third one is a session object.
- getQueryParams() - Returns query params as an array if available
- getFormData() - Returns information from the form as an array
- getSessionData() - Returns session data as an array
Useful methods in the Response
Object
- addBody() - Attach html code to one string for the correct body format
- addHeader() - Add one header to the Response Headers
- render() - Render header and body into correct html output code
Session
Object
The Session Object handles with magic properties and methods.
- Set properties via __construct or define properties with the session object
(example)
1. $session = new Session(["foo" => "bar"]);
2. $session->foo = "bar";
- Get properties
(example)
$session = new Session(["foo" => "bar"]);
$data = $session->foo;