PHP code example of shiftonelabs / laravel-cors

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

    

shiftonelabs / laravel-cors example snippets

 php
ShiftOneLabs\LaravelCors\LaravelCorsServiceProvider::class,
 bash
php artisan vendor:publish --provider="ShiftOneLabs\LaravelCors\LaravelCorsServiceProvider" --tag="config"
 php
protected $middleware = [
    /* ... */,
    \ShiftOneLabs\LaravelCors\Http\Middleware\ApplyCorsPolicy::class,
]
 php
protected $routeMiddleware = [
    /* ... */,
    'cors.policy' => \ShiftOneLabs\LaravelCors\Http\Middleware\ApplyCorsPolicy::class,
]
 php
Route::get('example-route', 'ExampleController@index')->middleware('cors.policy:app1');