adinan-cenci / psr-17
An implementation of the PSR-17 specification.
v1.0.8
2023-09-08 00:27 UTC
Requires
- adinan-cenci/psr-7: ^1.1.3
- psr/http-factory: ^1.0
Requires (Dev)
- phpunit/phpunit: 9.5.x-dev
- dev-master
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-issue-11/psr-12-compliance
- dev-issue-9/error-instantiating-uri-objects-2-electric-boogaloo
- dev-issue-7/error-instantiating-uri-objects
- dev-issue-5/error-parsing-form-data
- dev-issue-1/properly-supporting-put-and-other-methods
This package is auto-updated.
Last update: 2025-05-28 23:36:04 UTC
README
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