PHPackages                             mahmoud-birdsol/cors-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. mahmoud-birdsol/cors-laravel

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mahmoud-birdsol/cors-laravel
============================

Laravel Cross origin resource sharing package

1566PHP

Since Aug 8Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mahmoud-birdsol/cors-laravel)[ Packagist](https://packagist.org/packages/mahmoud-birdsol/cors-laravel)[ RSS](/packages/mahmoud-birdsol-cors-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Cross-origin resource sharing for laravel applications
======================================================

[](#cross-origin-resource-sharing-for-laravel-applications)

This package give's a middleware to allow for resource sharing across different origins useful for api development with laravel. *This package is still in development more options will be added*

### Usage

[](#usage)

Require the package through composer

```
composer require mahmoud-birdsol/cors-laravel:dev-master

```

Add the service provider to the app service providers in `config/app.php`

```
/*
* Other Service Providers...
*/
MahmoudBirdsol\CORSLaravel\CORSServiceProvider::class,

```

Publish the config file (cors.php)

```
php artisan vendor:publish --provider="MahmoudBirdsol\CORSLaravel\CORSServiceProvider"

```

Add the middleware to the api route group

```
'api' => [
    'throttle:60,1',
    MahmoudBirdsol\CORSLaravel\CORSMiddleware::class,
],

```

Modify the `config/cors.php` file sensible defaults exist for all options except for the allowed origins.

```
