This repository is a library of http clients - Response, Request and Session.
The library code provides a Makefile:
$ make help
bootstrap Install composer
update Update composer packages
tests Execute test suite
$ https://packagist.org/packages/jimdo/http
$ composer require jimdo/http
# 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
- __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
- 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
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;