php-extended / php-api-endpoint-http-object
An implementation of the php-extended/php-api-endpoint-http-interface library
Package info
gitlab.com/php-extended/php-api-endpoint-http-object
pkg:composer/php-extended/php-api-endpoint-http-object
Requires
Requires (Dev)
This package is auto-updated.
Last update: 2023-08-18 07:59:40 UTC
README
An implementation of the php-extended/php-api-endpoint-http-interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-api-endpoint-http-object ^6
Basic Usage
This library is made to be extended. The HttpEndpoint implementation is a generic object that is made to ease the transform into a really useful endpoint that may be something like
use PhpExtended\Endpoint\Endpoint;
class MyEndpoint extends HttpEndpoint
{
public function getFoo() : Foo
{
$stringData = $this->httpGet($this->createUri('https://example.com'));
return $this->getObject(Foo::class, new CustomDataProvider($stringData));
}
}
Where getDataProvider() is a method that returns a data provider that
get raw data, either from a file (csv, json, yaml, etc.) or network (json api,
rest api, xml, parsed html, etc, even semantic formats..)
License
MIT (See license file).