Download the PHP package effectra/cors without Composer
On this page you can find all versions of the php package effectra/cors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download effectra/cors
More information about effectra/cors
Files in effectra/cors
Package cors
Short Description PHP library for enabling CORS (Cross-Origin Resource Sharing) in HTTP requests/responses. It follows PSR guidelines, and can be easily integrated into PHP projects.
License MIT
Informations about the package cors
Effectra/cors
Effectra/cors is a PHP package that provides middleware and service classes for handling Cross-Origin Resource Sharing (CORS) in web applications. CORS is a security feature implemented by web browsers to control access to resources on a different origin.
Installation
You can install the Effectra/cors package via Composer:
Usage
CorsMiddleware
The CorsMiddleware
class is a PSR-15 middleware that can be used in a middleware stack to handle CORS requests. It checks incoming requests for CORS-related headers and adds appropriate headers to the response.
Example:
CorsService
The CorsService
class provides the core functionality for handling CORS requests. It allows you to configure various CORS-related settings.
Example:
Configuration
The CorsService
class allows you to configure various CORS-related settings using an options array.
Available Options:
allowedOrigins
: An array of allowed origins.allowedOriginsPatterns
: An array of allowed origin patterns (wildcards).allowedMethods
: An array of allowed HTTP methods.allowedHeaders
: An array of allowed headers.supportsCredentials
: Whether credentials (cookies, HTTP authentication) should be supported.maxAge
: Maximum time (in seconds) that the results of a preflight request can be cached.exposedHeaders
: An array of headers exposed to the response.
Contributing
If you'd like to contribute to this project, please follow our contribution guidelines.
License
The Effectra/cors package is open-sourced software licensed under the MIT license.
All versions of cors with dependencies
psr/http-server-handler Version ^1.0@dev
psr/http-server-middleware Version ^1.0@dev