-
Notifications
You must be signed in to change notification settings - Fork 25
Configuration
The package comes with various configurable options. To override the default options, you need to publish the config file using the following command:
php artisan vendor:publish --provider="Froiden\RestAPI\Providers\ApiServiceProvider"
After running this command, a new file api.php
will be created in your config directory.
Note: You may not understand some of the the options described below until you read the later chapters of this wiki and start using the package.
The default number of records to return when the user does not specify the limit
parameter. You can set a value that suits your needs. For example, Facebook Graph API returns 25 records by default.
The maximum number of records a user can request in a single API call. Without this option, the user will be able to request an infinite number of records, in a single call, putting a heavy load on your API. It defaults to 1000.
Add cross-origin headers to responses, enabling API calls from any domain. It is recommended by Microsoft REST API Guidelines to allow cross-origin requests. However, you can disable it with this option.
The package supports saving and updating of models out of the box. This feature uses all fields from a request and assumes to be model attributes. If you are sending some fields that are not model attributes, specify them in this list.
The prefix to add to API routes. Set it to null
for no prefix.
The package supports API versioning. This parameter defined what version should a route be assigned if no version is defined for it in routes.php
. If this is set to null
, no API version will be assigned that route.