2017 © Pedro Peláez
 

library network

Simple library for network HTTP requests

image

alxmsl/network

Simple library for network HTTP requests

  • Friday, December 18, 2015
  • by alxmsl
  • Repository
  • 2 Watchers
  • 1 Stars
  • 6,072 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

Network

Native network requests driver for PHP, (*1)

Installation

Require packet in a composer.json, (*2)

"alxmsl/network": ">=1.0.0"

Run Composer: php composer.phar install, (*3)

Usage example

// Firstly include base class
include('../source/Autoloader.php');

use Network\Http\Request;

// Create request object
$Request = new Request();
$Request->setUrl('http://topface.com')
    ->setConnectTimeout(3)
    ->setTimeout(5);

Now you need to select transport type. Today it supports only curl transport type, but if future will other types. For example, sockets, (*4)

$Request->setTransport(Request::TRANSPORT_CURL);

Using curl transport, you can add any additional curl options, (*5)

$Request->getTransport()->setOption(CURLOPT_FOLLOWLOCATION, true);

You can add url parameters for requests like a http://some.body/param1/value1/param2/value2, (*6)

$Request->addUrlField('param1', 'value1')
    ->addUrlField('param2', 'value2');

You can add GET parameters, (*7)

$Request->addGetField('param3', 'value3')
    ->addGetField('param4', 'value4');

You can add POST parameters, (*8)

$Request->addPostField('field5', 'value5');
$Request->addPostField('field6', 'value6');

And send the request, (*9)

$data = $Request->send();

License

Copyright © 2014 Alexey Maslov alexey.y.maslov@gmail.com This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details., (*10)

The Versions

18/12 2015

dev-master

9999999-dev

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

18/12 2015

dev-psr7

dev-psr7

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

18/12 2015

v1.1.2

1.1.2.0

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

12/12 2015

v1.1.1

1.1.1.0

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

25/02 2015

v1.1.0

1.1.0.0

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

12/07 2014

v1.0.1

1.0.1.0

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

api curl http

11/07 2014

v1.0.0

1.0.0.0

Simple library for network HTTP requests

  Sources   Download

WTFPL

by Avatar alxmsl

curl http