1. Go to this page and download the library: Download makise-co/stack-cors 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/ */
makise-co / stack-cors example snippets
return [
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => ['*'],
/*
* Matches the request method. `[*]` allows all methods.
*/
'allowedMethods' => ['*'],
/*
* Matches the request origin. `[*]` allows all origins.
*/
'allowedOrigins' => ['*'],
/*
* Matches the request origin with, similar to `Request::is()`
*/
'allowedOriginsPatterns' => [],
/*
* Sets the Access-Control-Allow-Headers response header. `[*]` allows all headers.
*/
'allowedHeaders' => ['*'],
/*
* Sets the Access-Control-Expose-Headers response header.
*/
'exposedHeaders' => false,
/*
* Sets the Access-Control-Max-Age response header.
*/
'maxAge' => 600,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supportsCredentials' => true,
];