Skip to content

adinan-cenci/psr-17

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSR-17

This is an implementation of the PSR-17 specification.

Besides the psr methods, the factories also include some useful methods:

ResponseFactory

use AdinanCenci\Psr17\ResponseFactory;

$responseFactory = new ResponseFactory();

// Returns an instance of Psr\Http\Message\ResponseInterface with 
// code 200
$factory->ok('your body here');

// 201
$factory->created('your body here');

// 301
$factory->movedPermanently('http://redirect.to');

// 302
$factory->movedTemporarily('http://redirect.to');

// 400
$factory->badRequest('your body here');

// 401
$factory->unauthorized('your body here');

// 403
$factory->forbidden('your body here');

// 404
$factory->notFound('your body here');

// 500
$factory->internalServerError('your body here');

// 501
$factory->notImplemented('your body here');

// 502
$factory->badGateway('your body here');

// 503
$factory->serviceUnavailable('your body here');

ServerRequestFactory

use AdinanCenci\Psr17\ServerRequestFactory;

$requestFactory = new ServerRequestFactory();

// Creates an instance of Psr\Http\Message\ServerRequestInterface
// out of the global values.
$request = $requestFactory->createFromGlobals();

UploadedFileFactory

use AdinanCenci\Psr17\UploadedFileFactory;

$filesFactory = new UploadedFileFactory();

// Will return the contents of $_FILES as 
// Psr\Http\Message\UploadedFileInterface instances.
$files = $filesFactory->getFilesFromGlobals();




Licence

Mit

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages