PHP code example of havenshen / slim-cors

1. Go to this page and download the library: Download havenshen/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/ */

    

havenshen / slim-cors example snippets


$app = new \Slim\App([
    'settings' => [
        'dispayErrorDetails' => true,
    ]
]);

$container = $app->getContainer();

$container['cors'] = function ($c) {
    return new \HavenShen\Slim\Cors\Guard;
};

$app->add($container->get('cors'));