PHP code example of zmarquez / stackphp-ampcors
1. Go to this page and download the library: Download zmarquez/stackphp-ampcors library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
zmarquez / stackphp-ampcors example snippets
use Zmc\Stack\AmpCorsMiddleware;
= (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);