Configuring the API.
Published configuration files reside in
├── config/streams/ │ └── api.php
Use the following command to publish configuration files.
php artisan vendor:publish --provider=Streams\\Api\\ApiServiceProvider --tag=config
The above command will copy configuration files from their package location to the directory mentioned above so that you can modify them directly and commit them to your version control system.
Below are the contents of the published configuration file:
// config/streams/api.php return [ /* * Determine if the API should be enabled. * This is DISABLED by default because * the API is public by default. */ 'enabled' => env('STREAMS_API_ENABLED', false), /* * Specify the API prefix. */ 'prefix' => env('STREAMS_API_PREFIX', 'api'), /* * Specify the API fallback policy. * * This policy will be ran if no stream * or route policy is otherwise specified. */ 'policy' => env('STREAMS_API_POLICY'), /* * Specify the API group middleware. * * This is designed to match out of the box * "app/Providers/RouteServiceProvider.php" * and "app/Http/Kernel.php" Laravel files. * * Changing this value will require * adjusting the above files. */ 'middleware' => env('STREAMS_API_MIDDLEWARE', 'api'), ];
API middleware an be configured in your application's HTTP kernel.
// app/Http/Kernel.php protected $middlewareGroups = [ 'api' => [ 'throttle:60,1', 'bindings', ], ];
app/Providers/RouteServiceProvider.php file typically uses the
api middleware group when loading the
routes/api.php file. By default this file is compatible with this package and routes defined there will be properly prefixed and grouped.
If you configure a non-standard middleware group to use, you will have to adjust all the above files accordingly.