2017 © Pedro Peláez
 

library web-tools

A collection of PHP classes used for making and handling web requests.

image

communitycart/web-tools

A collection of PHP classes used for making and handling web requests.

  • Wednesday, January 3, 2018
  • by jeffreylroberts
  • Repository
  • 0 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Web Tools

A collection of PHP classes used for making web requests, and parsing information related to the HTTP protocol., (*1)

Overview

This library contains classes which can be used to perform the following tasks:, (*2)

  • Make GET/POST requests to remote servers.
  • Parse raw HTTP headers, and build raw HTTP headers.
  • Parse raw HTTP requests.
  • Provides a very small web server written in PHP for testing purposes.

Requirements

Installing

The library may be installed using either git or Composer, but I strongly recommend using Composer so dependencies will be automatically installed. Add the web-tools dependency to your composer.json using the following code:, (*3)

"require": {
    "headzoo/web-tools" : "dev-master"
}

Quick Start

<?php
use Headzoo\Web\Tools\WebClient;
use Headzoo\Web\Tools\HttpMethods;

// Make a simple GET request.
$web = new WebClient();
$response = $web->get("http://headzoo.io");

// Make a simple POST request.
$web = new WebClient();
$response = $web->post("http://headzoo.io", ["arg1" => "value1"]);

// The response is an instance of WebResponse, which provides the response information.
echo $response->getCode();
echo $response->getBody();
print_r($response->getHeaders());

// Making a requests with more configuration.
$web = new WebClient(HttpMethods::GET);
$web
    ->addHeader("Content-Type", "application/json")
    ->setUserAgent("My-Web-Client")
    ->setBasicAuth("headzoo", "password");
$response = $web->request("http://headzoo.io");

Class Documentation

This readme only briefly discussing some of the important classes in the library. See the class source code for more information., (*4)

Headzoo\Web\Tools\WebClient

Used to make any kind of HTTP request, including GET, POST, PUT, and DELETE., (*5)

Headzoo\Web\Tools\WebResponse

Represents a server response from a HTTP request., (*6)

Headzoo\Web\Tools\WebServer

A small, not yet finished testing web server., (*7)

Headzoo\Web\Tools\WebRequest

Represents an incoming web request., (*8)

Headzoo\Web\Tools\Builders\Headers

Normalizes and builds raw HTTP headers., (*9)

Headzoo\Web\Tools\Parsers\Headers

Parses raw HTTP headers into an array of key/value pairs., (*10)

Headzoo\Web\Tools\Parsers\Request

Parses a raw HTTP request into body, headers, etc., (*11)

Headzoo\Web\Tools\HttpMethods

Class of constants representing the supported request methods., (*12)

Headzoo\Web\Tools\Utils

Contains various utility methods used through out the library., (*13)

Change Log

v0.2 - 2013-12-31
  • Major overhaul.
v0.1 - 2013-12-18
  • Released code under MIT license.

TODO

  • Add cookie management.
  • Add certificate management.

License

This content is released under the MIT License. See the included LICENSE for more information., (*14)

The Versions

03/01 2018

dev-master

9999999-dev

A collection of PHP classes used for making and handling web requests.

  Sources   Download

MIT

The Requires

 

by communitycart

php http web

27/03 2014

dev-dev-0.3

dev-dev-0.3

A collection of PHP classes used for making and handling web requests.

  Sources   Download

MIT

The Requires

 

by Avatar headzoo

php http web

25/03 2014

0.2

0.2.0.0

A collection of PHP classes used for making and handling web requests.

  Sources   Download

MIT

The Requires

 

by Avatar headzoo

php http web

24/03 2014

0.1

0.1.0.0

A collection of PHP classes used for making and handling web requests.

  Sources   Download

MIT

The Requires

 

by Avatar headzoo

php http web