PHPackages                             mbpcoder/laravel-api-versioning - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mbpcoder/laravel-api-versioning

ActiveLibrary[API Development](/categories/api)

mbpcoder/laravel-api-versioning
===============================

Enable Api Versioning for Laravel

v1.3(3y ago)19180.2k—2.2%5[2 issues](https://github.com/mbpcoder/laravel-api-versioning/issues)MITPHP

Since Jun 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/mbpcoder/laravel-api-versioning)[ Packagist](https://packagist.org/packages/mbpcoder/laravel-api-versioning)[ Docs](https://github.com/mbpcoder/laravel-api-versioning)[ RSS](/packages/mbpcoder-laravel-api-versioning/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

API Versioning for Laravel
==========================

[](#api-versioning-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8d7b0eb17152aebb87a2b7e0371098e0d0fb9128c261329a12d58b6f54bacac7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6270636f6465722f6c61726176656c2d6170692d76657273696f6e696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mbpcoder/laravel-api-versioning)[![Total Downloads](https://camo.githubusercontent.com/3f89c452e275f3a95d638de7e88c197334d8885d916487097efdc30ed18d634d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6270636f6465722f6c61726176656c2d6170692d76657273696f6e696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mbpcoder/laravel-api-versioning)

This is a very simple package to support API versioning in Laravel 8,7,6,5. this package provide fallback API capability for Laravel.

Features
--------

[](#features)

- If you have one API version it will automatically disable
- You can disable package in config files
- You can add countless API Versions in config file
- Does not affect routes except API

Let's Code!
-----------

[](#lets-code)

If you call for /{version\_number}/version every API have it is own route. If you call for /v2.1/hello-world it will try to call v2.1 and if it does not find a route will search v2 then if the version 2 also does not have the routes it will fallback to v1

```
// laravel route file
Route::prefix('v2.1')->group(function () {
    Route::get('version', function () {
        return 'API v2.1';
    });
});

Route::prefix('v2')->group(function () {
    Route::get('version', function () {
        return 'API v2';
    });
});

Route::prefix('v1')->group(function () {
    Route::get('version', function () {
        return 'API v1';
    });

    Route::get('hello-world', function () {
        return 'Hello World!';
    });
});
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require mbpcoder/laravel-api-versioning
```

Usage
-----

[](#usage)

Publish config file

```
php artisan vendor:publish --provider="MbpCoder\ApiVersioning\ApiVersioningServiceProvider"
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Mahdi Bagheri](https://github.com/mbpcoder)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~339 days

Total

4

Last Release

1141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47ca7d89ddf7e0cd20c6c17b516919c1de6bf1af2702e37999ec296954ecf51a?d=identicon)[mb-programmer](/maintainers/mb-programmer)

---

Top Contributors

[![mbpcoder](https://avatars.githubusercontent.com/u/3877538?v=4)](https://github.com/mbpcoder "mbpcoder (17 commits)")[![promatik](https://avatars.githubusercontent.com/u/1838187?v=4)](https://github.com/promatik "promatik (1 commits)")

---

Tags

laravellaravel-packageapi versioningmbpcoder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mbpcoder-laravel-api-versioning/health.svg)

```
[![Health](https://phpackages.com/badges/mbpcoder-laravel-api-versioning/health.svg)](https://phpackages.com/packages/mbpcoder-laravel-api-versioning)
```

###  Alternatives

[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k10.7M93](/packages/nuwave-lighthouse)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3121.5M10](/packages/api-ecosystem-for-laravel-dingo-api)[reindert-vetter/api-version-control

A Laravel package to manage versions of endpoints in an elegant way

1671.0M](/packages/reindert-vetter-api-version-control)[flat3/lodata

OData v4.01 Producer for Laravel

96320.9k](/packages/flat3-lodata)[develpr/alexa-app

Set of classes to make creating simple Amazon Echo Alexa Apps easier with Lumen and to a lesser extent Laravel

9711.1k](/packages/develpr-alexa-app)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
