PHP code example of zrnik / php-slim-cors
1. Go to this page and download the library: Download zrnik/php-slim-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/ */
zrnik / php-slim-cors example snippets
$app = new \Slim\App();
$app->add(new \Zrnik\SlimCors\CorsMiddleware());
$app = new \Slim\App();
$app->add(
new \Zrnik\SlimCors\CorsMiddleware(
allowedOrigins: [
'my-frontend.app',
'another-app.com',
],
allowedMethods: [
'GET', 'POST'
]
)
);
composer