https://github.com/phpnexus/cors
Provides a lightweight, extensible, framework-agnostic CORS class
https://github.com/phpnexus/cors
Last synced: 4 months ago
JSON representation
Provides a lightweight, extensible, framework-agnostic CORS class
- Host: GitHub
- URL: https://github.com/phpnexus/cors
- Owner: phpnexus
- License: apache-2.0
- Created: 2016-05-03T09:47:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2026-02-12T08:24:53.000Z (4 months ago)
- Last Synced: 2026-02-12T15:47:45.010Z (4 months ago)
- Language: PHP
- Homepage:
- Size: 102 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CORS
[](https://github.com/phpnexus/cors/releases)
[](https://travis-ci.org/phpnexus/cors)
[](LICENSE.md)
Provides a lightweight, extensible, framework-agnostic CORS class.
**You probably want to check these specific implementations for easy installation**
* [PSR-7](https://github.com/phpnexus/cors-psr7)
## Installation
It's recommended that you use [Composer](https://getcomposer.org/) to install Cors:
```bash
$ composer require phpnexus/cors
```
This package requires PHP 7.4 or 8.1.
## Usage
TODO
## Configuration
### Allow-Methods
Default: `[]`
An array of allowed HTTP methods. These names are **case-sensitive**.
Example: `['GET', 'POST']`
### Allow-Headers
Default: `[]`
Example: `['Content-Type']`
### Allow-Origins
Default: `[]`
An array of allowed origins, in the form `scheme://hostname`.
Example: `['http://example.com', 'https://example.com']`
**This is not a replacement for proper access control measures.**
Note: An asterisk (`*`) _can_ also be used to allow any origin, but as per the specification the asterisk (`*`) _cannot_ be used when Allow-Credentials is `true`.
### Allow-Credentials
Default: `false`
Use `true` to allow cookies to be sent with the request.
Note: Cannot be `true` when the Allow-Origin contains `"*"`.
### Expose-Headers
Default: `[]`
### Max-Age
Default: `0` (no cache)
Number of seconds to cache the preflight response.
## Roadmap
* Benchmarks
## Versioning
The packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility between minor versions.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## License
This package is released under the Apache 2.0 License. See the bundled [LICENSE](https://github.com/phpnexus/cors/blob/master/LICENSE) file for details.