trademachines / silex-cors-provider
Service provider for Silex for addings CORS support
This package's canonical repository appears to be gone and the package has been frozen as a result.
0.2.0
2016-06-21 05:36 UTC
Requires
- php: ^7.0
- silex/silex: ^2.0
Requires (Dev)
- phpunit/phpunit: @stable
This package is not auto-updated.
Last update: 2023-11-07 18:15:52 UTC
README
Service provider for addings CORS capabilities to Silex.
Usage
There is no way of defining app-wide CORS settings, you have to do this for every single route or add necessary logic on top of the service provider.
The enable CORS support register the provider first:
$app->register(new CorsServiceProvider());
Then add CORS support per route:
$cors = new Cors();
$cors->allowOrigin('http://my.domain.com');
$app
->put('/posts', function() {})
->cors($cors);