PHP code example of denismitr / laracors

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

    

denismitr / laracors example snippets


'providers' => [
    ...
    \Denismitr\Laracors\LaravelCorsServiceProvider::class,
],

protected $middleware = [
    ...
    \Denismitr\Laracors\Cors::class
];

php artisan vendor:publish  --provider="Denismitr\Laracors\LaravelCorsServiceProvider"


protected $routeMiddleware = [
    ...
    'cors' => \Denismitr\Laracors\LaravelCorsServiceProvider::class,
];

protected $middlewareGroups = [
    'web' => [
        ...
    ],

    'api' => [
        ...
        'cors'
    ],
];

Route::put('post/{id}', function ($id) {
    //
})->middleware('cors:get,post,put');

$app->register('\Denismitr\Laracors\LumenCorsServiceProvider');

$app->middleware([
    .....
    '\Denismitr\Laracors\Cors',
]);
config/app.php
config/laracors.php