zmarquez / stackphp-ampcors
AMP CORS middleware for StackPHP
Installs: 182
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/zmarquez/stackphp-ampcors
Requires
- php: >=5.4.0
- symfony/http-kernel: ~2.1 | ~3.0
This package is auto-updated.
Last update: 2025-12-15 02:59:51 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"
}
}