Download the PHP package uttamrabadiya/api-version-manager without Composer
On this page you can find all versions of the php package uttamrabadiya/api-version-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uttamrabadiya/api-version-manager
More information about uttamrabadiya/api-version-manager
Files in uttamrabadiya/api-version-manager
Package api-version-manager
Short Description Simplify Laravel API versioning with ease. No more separate controllers—just flexibility, fallbacks, and version-specific components.
License MIT
Homepage https://github.com/uttamrabadiya/api-version-manager
Informations about the package api-version-manager
Laravel API Version Manager
The Laravel API Version Manager Package streamlines the management of API endpoint versions in Laravel applications. This package empowers you to effortlessly handle API versioning, eliminating the necessity to create individual controllers for each version. Its design presents a flexible and efficient solution, enabling you to define fallback versions and effortlessly generate version-specific Requests and Resources.
Features
- Fallback Versions: Define fallback versions for your API routes, ensuring smooth transitions and maintaining backward compatibility.
- Single Controller: Eliminate the need to create separate controllers for each API version. Our package dynamically injects version-specific Request and Resource classes into your existing controller.
- Effortless Versioning: Easily manage API versions through route configuration. The package automatically handles the resolution of version-specific components, streamlining your development process.
Installation
You can install the package via Composer:
Configuration
Publish Config File
It is mandatory to publish the config file before using the package. You can publish the config file using the following command:
Mandatory Configurations:
- Define available
versions
array in config - Define default version
version
in config
Other possible configurations are:
app_http_namespace
(default:App\Http
) - Generally we useApp\Http
namespace to store all our requests & resources classes, but if you are using different namespace then you can define it here.api_prefix
(default:api
) - API prefix for all versioned routes.use_fallback_entity
(default:true
) - If you want to use fallback entity for all request & resource class then set this totrue
, otherwise set it tofalse
. For example, you defineSampleRequest
in V1, and now you want to use same request in V2 then you can set this option totrue
and it will automatically useSampleRequest
from V1.
Available Commands
Create a new versioned request
Possible options:
--force
: Overwrite the request if it already exists.
Create a new versioned resource
Possible options:
--collection
: Create a resource collection instead of a single resource.--force
: Overwrite the resource if it already exists.
Usage
Example of api.php
file:
Example of SomeController.php
file:
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.