piotrpress/remoter

This library is a chainable HTTP Client based on file_get_contents() function.

v1.0.0 2022-05-06 13:48 UTC

This package is not auto-updated.

Last update: 2024-12-18 00:46:12 UTC


README

This library is a chainable HTTP Client based on file_get_contents() function.

Installation

$ composer require piotrpress/remoter

Example

require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Remoter\Request;
use PiotrPress\Remoter\Url;
use PiotrPress\Remoter\Header;

echo ( ( new Request(
    ( new Url(
        'https://api.github.com'
    ) )->setPath( '/repos/PiotrPress/remoter' ),
    'GET',
    ( new Header(
        [ 'User-Agent' => 'PiotrPress/Remoter' ],
        true
    ) )->set( 'Accept', 'application/vnd.github.v3+json' )
) )->send() )->getHeader()->get( 'code' );

Requirements

PHP >= 7.4 version.

License

MIT