API Versioning
Since Laravel does not support API versioning, Apiato provide a very easy way to implement versioning for your API.
How it works#
Create:
When creating a new API endpoint, specify the version number in the route file name following this naming format {endpoint-name}.{version-number}.{documentation-name}.php.
Example:
MakeOrder.v1.public.phpMakeOrder.v2.public.phpListOrders.v1.private.php
Use:
Automatically the endpoint inside that route file will be accessible by adding the version number to the URL.
Example:
http://api.apiato.test/v1/registerhttp://api.apiato.test/v1/ordershttp://api.apiato.test/v2/stores/123
Version the API in header instead of URL#
First remove the URL version prefix:
- Edit
app/Ship/Configs/apiato.php, set prefix to'enable_version_prefix' => 'false',. - Implement the Header versioning anyway you prefer. (this is not implemented in Apiato yet. Consider a contribution).