zmarquez / stackphp-ampcors
AMP CORS middleware for StackPHP
v1.1
2020-01-13 17:03 UTC
Requires
- php: >=5.4.0
- symfony/http-kernel: ~2.1 | ~3.0
This package is auto-updated.
Last update: 2025-04-15 01:41:35 UTC
README
This package contains a StackPHP middleware that manages the AMP security CORS requests.
Options
The AmpCorsMiddleware
accepts an array of options:
- publisherOrigin: contains the value of the source origin.
- queryString: array with parameters to add of the request.
Example
<?php use Zmc\Stack\AmpCorsMiddleware; require_once __DIR__ . '../vendor/autoload.php'; $app = new Silex\Application(); $stack = (new Stack\Builder()) ->push( AmpCorsMiddleware::class, [ 'publisherOrigin' => 'https://example.com', 'queryString' => [ 'lang' => 'es' ] ]); $app = $stack->resolve($app); $request = Request::createFromGlobals(); $response = $app->handle($request)->send(); $app->terminate($request, $response);
Installation
The recommended way to install AmpCorsMiddleware
is through Composer:
{ "require": { "zmarquez/stackphp-ampcors": "dev-master" } }