New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

iambib/api-version-fallback

A package that allows you to have a fallback version of your api
2,099
Install
composer require iambib/api-version-fallback
Latest Version:v1.0.4
PHP:>= 8.0.2
Laravel:11
License:BSD-3-Clause
Last Updated:Apr 5, 2025
Links: GitHub  ·  Packagist
Maintainer: iamBiB

Lumen Api Versioning

A package that allows you to have a fallback version for your Lumen api

Description

This package allows you to have fallback versions for your api. Basically if you have v1 in place and you want to update your app to v2 but you don't have time to update all methods, this pack allows you to take a break. Eg. #1 api.dev/v2/users will fallback to api.dev/v1/users if v2 is not found Eg. #2 api.dev/v3/users will fallback to api.dev/v2/users if found, if not api.dev/v1/users

Installation

    composer require iambib/lumen-api-versioning

config file Create a config file named api-versioning.php and add the following lines

return [
    /**
     * Enable the fallback
     */
    'enable' => true,
    /**
     * Available api versions
     */

    'available_versions' => [
        'v1',
        'v2',
    ],
    /**
     * Set them in order you want the fallback to happen
     * Eg. If v4 is not found v3 is the first one to check if exists. If not, v2 then v1.
     */
    'api_fallbacks' => [
        'v3', 'v2', 'v1',
    ],
    /*
     * URL segment number of your api version
     */
    'segment_no' => 0,
];

bootstrap/app.php

	$app = new \iAmBiB\ApiVersionFallback\Extension\Application(
		$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
	);
 	...
   $app->middleware([
		...
		'api_versioning_fallback' => \iAmBiB\ApiVersionFallback\Middleware\ApiVersioningFallback::class,
	]);
	...
	$app->configure('api-versioning');

Support

Hey dude! If you like it .. well or a would be nice :D

coffee

Related Packages

bwt-team/laravel-api

Package helping with API development

11,339 1
noitran/lumen-form-requests

Missing form requests functionality for lumen, ported from laravel framework.

4,750 5
nebo15/lumen.rest

Components for fast building REST API for Lumen

3,761 1
ngabor84/lumen-api-query-parser

A query parser for REST-APIs based on laravel's lumen framework

1,485 3
nextdots/api-exceptions

JSON exceptions for your API

385 0

Version History

Version Released PHP License
v1.0.4 >= 8.0.2 BSD-3-Clause
v1.0.3 >= 8.0.2 BSD-3-Clause
v1.0.2 >= 8.0.2 BSD-3-Clause
v1.0.1 >= 8.0.2 BSD-3-Clause