2017 © Pedro Peláez
 

library sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

image

vaibhavpandeyvpz/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  • Sunday, July 23, 2017
  • by vaibhavpandeyvpz
  • Repository
  • 1 Watchers
  • 2 Stars
  • 411 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

vaibhavpandeyvpz/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 7.0., (*1)

Sandesh: संदेश (message), (*2)

Build status Code Coverage Latest Version Downloads PHP Version License, (*3)

SensioLabsInsight, (*4)

Install

composer require vaibhavpandeyvpz/sandesh

Usage

<?php

/**
 * @desc Creates an instance of Psr\Http\Message\RequestInterface.
 */
$request = (new Sandesh\RequestFactory())
    ->createRequest('POST', 'https://api.example.com/user/save');

/**
 * @desc Creates an instance of Psr\Http\Message\ServerRequestInterface.
 */
$request = (new Sandesh\ServerRequestFactory())
    ->createServerRequest('POST', 'https://api.example.com/user/save', $_SERVER);

/**
 * @desc Creates an instance of Psr\Http\Message\ResponseInterface.
 */
$response = (new Sandesh\ResponseFactory())
    ->createResponse(404);

/**
 * @desc Creates an instance of Psr\Http\Message\StreamInterface.
 */
$stream = (new Sandesh\StreamFactory())
    ->createStream();

// or
$stream = (new Sandesh\StreamFactory())
    ->createStreamFromFile('/path/to/file');

// or
$stream = (new Sandesh\StreamFactory())
    ->createStreamFromResource(fopen('php://input', 'r'));

/**
 * @desc Creates an instance of Psr\Http\Message\UploadedFileInterface.
 */
$stream = (new Sandesh\StreamFactory())
    ->createStreamFromFile($_FILES[0]['tmp_name']);
$request = (new Sandesh\UploadedFileFactory())
    ->createUploadedFile(
        $stream,
        $_FILES[0]['size'],
        $_FILES[0]['error'],
        $_FILES[0]['name'],
        $_FILES[0]['type']);

/**
 * @desc Creates an instance of Psr\Http\Message\UriInterface.
 */
$uri = (new Sandesh\UriFactory())
    ->createUri('http://domain.tld:9090/subdir?test=true#phpunit');

Bonus

<?php

/**
 * @desc Parse Set-Cookie header(s) and create an instance of Sandesh\CookieInterface.
 */
$cookie = (new Sandesh\CookieFactory())
    ->createCookie('PHPSESS=1234567890; Domain=domain.tld; Expires=Wed, 21 Oct 2015 07:28:00 GMT; HttpOnly; Max-Age=86400; Path=/admin; Secure');

/**
 * @desc After making changes you can just cast it to a RFC-6265 valid string as show below.
 */
$header = (string)$cookie;

Documentation

To view detailed instructions, please visit the Wiki., (*5)

License

See LICENSE file., (*6)

The Versions

23/07 2017

dev-master

9999999-dev http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

23/07 2017

1.0.5

1.0.5.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

12/02 2017

1.0.4

1.0.4.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

02/02 2017

1.0.3

1.0.3.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

30/01 2017

1.0.2

1.0.2.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

28/01 2017

1.0.1

1.0.1.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17

28/01 2017

1.0

1.0.0.0 http://vaibhavpandeyvpz.github.io/sandesh

PSR-7 and PSR-17 implementation, works with PHP >= 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

psr-7 http message factory psr-17