2017 © Pedro Peláez
 

library http

Asynchronous HTTP component for Icicle.

image

icicleio/http

Asynchronous HTTP component for Icicle.

  • Wednesday, November 23, 2016
  • by Trowski
  • Repository
  • 13 Watchers
  • 62 Stars
  • 28,794 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 7 Forks
  • 11 Open issues
  • 7 Versions
  • 2 % Grown

The README.md

HTTP for Icicle

Asynchronous, non-blocking HTTP/1.1 client and server., (*1)

This library is a component for Icicle that provides an HTTP/1.1 server and client implementations. Like other Icicle components, this library uses Coroutines built from Awaitables and Generators to make writing asynchronous code more like writing synchronous code., (*2)

Build Status Coverage Status Semantic Version MIT License @icicleio on Twitter, (*3)

Documentation and Support

Requirements
  • PHP 5.5+ for v0.3.x branch (current stable) and v1.x branch (mirrors current stable)
  • PHP 7 for v2.0 (master) branch supporting generator delegation and return expressions
Suggested
Installation

The recommended way to install is with the Composer package manager. (See the Composer installation guide for information on installing and using Composer.), (*4)

Run the following command to use this library in your project:, (*5)

composer require icicleio/http

You can also manually edit composer.json to add this library as a project requirement., (*6)

// composer.json
{
    "require": {
        "icicleio/http": "^0.3"
    }
}

Example

The example below creates a simple HTTP server that responds with Hello, world! to every request., (*7)

#!/usr/bin/env php
<?php

require '/vendor/autoload.php';

use Icicle\Http\Message\{BasicResponse, Request, Response};
use Icicle\Http\Server\{RequestHandler, Server};
use Icicle\Socket\Socket;
use Icicle\Loop;

$server = new Server(new class implements RequestHandler {
    public function onRequest(Request $request, Socket $socket)
    {
        $response = new BasicResponse(Response::OK, [
            'Content-Type' => 'text/plain',
        ]);

        yield from $response->getBody()->end('Hello, world!');

        yield $response;
    }

    public function onError($code, Socket $socket)
    {
        return new BasicResponse($code);
    }
});

$server->listen(8080);

Loop\run();

The Versions

23/11 2016

dev-master

9999999-dev http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

21/04 2016

v0.3.x-dev

0.3.9999999.9999999-dev http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

21/04 2016

v1.x-dev

1.9999999.9999999.9999999-dev http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

09/03 2016

v0.3.0

0.3.0.0 http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

20/10 2015

v0.2.1

0.2.1.0 http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

01/10 2015

v0.2.0

0.2.0.0 http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async

26/08 2015

v0.1.0

0.1.0.0 http://icicle.io

Asynchronous HTTP component for Icicle.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Aaron Piotrowski

http asynchronous async