Download the PHP package struggle-for-php/sfp-cors-middleware without Composer
On this page you can find all versions of the php package struggle-for-php/sfp-cors-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download struggle-for-php/sfp-cors-middleware
More information about struggle-for-php/sfp-cors-middleware
Files in struggle-for-php/sfp-cors-middleware
Package sfp-cors-middleware
Short Description PSR-7 CORS Middleware
License MIT
Homepage https://github.com/struggle-for-php/sfp-cors-middleware
Informations about the package sfp-cors-middleware
PSR-7 CORS Middleware
This middleware implements Cross-origin resource sharing. It was originally developed for Slim but can be used with all frameworks using PSR-7 style middlewares. It has been tested with Slim Framework and Zend Expressive. Internally the middleware uses neomerx/cors-psr7 library for heavy lifting.
Install
Install using composer.
Usage
Documentation assumes you have working knowledge of CORS. There are no mandatory parameters. If called without any parameters the following defaults are used. Examples assume you are using Slim Framework.
However, you most likely want to change some of the defaults. For example if developing a REST API which supports caching and conditional requests you could use the following.
Other parameters
Logger
The optional logger
parameter allows you to pass in a PSR-3 compatible logger to help with debugging or other application logging needs.
Error
Error is called when CORS request fails. It receives last error message in arguments. This can be used for example to create application/json
responses when CORS request fails.
Testing
You can run tests either manually...
... or automatically on every code change.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of sfp-cors-middleware with dependencies
neomerx/cors-psr7 Version ^1.0
http-interop/http-middleware Version ^0.4.1