PHPackages                             jdlxnl/api-version - 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. jdlxnl/api-version

ActiveLibrary[API Development](/categories/api)

jdlxnl/api-version
==================

Add version as prefix to routes and make it available through a facade in Laravel

1.0.0(4y ago)04MITPHP

Since Dec 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jdlxnl/api-version)[ Packagist](https://packagist.org/packages/jdlxnl/api-version)[ RSS](/packages/jdlxnl-api-version/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Intro
=====

[](#intro)

Enables you to create an API version prefix, and make it available in your code.

After installation you can:

```
use Jdlx\ApiVersion\Facade\Version;

// get current version number as int
Version::number();

// Do something only for request to the old api
if(Version::before(2)){

}

// Do something only for request to the new api
if(Version::from(2)){

}
```

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

[](#installation)

```
composer require jdlxnl/api-version

```

Register the Facade

```
 // app/Http/kernel.php
 // Add api midleware

   protected $middlewareGroups = [
        'api' => [
            SetApiVersion::class,
          ],
    ];

// app/Config/app.php

  'providers' => [
        ...
        App\Library\ApiVersion\Provider\ApiVersionServiceProvider::class
    ]

 // change base path for swagger
 // app/Http/Documentation/Server

// Add the option to the router
// routes/api.php
$apiRoutes = function () {
    // define routes
};
Route::group(['prefix' => '{version?}', 'where' => ['version' => 'v[0-9]+']], $apiRoutes);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1607d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76caab2626cdfa35e2b169e284e6975c83b495f659cd1b21539d4b904f2af071?d=identicon)[jeroendelau](/maintainers/jeroendelau)

---

Top Contributors

[![jeroendelau](https://avatars.githubusercontent.com/u/5286898?v=4)](https://github.com/jeroendelau "jeroendelau (4 commits)")

### Embed Badge

![Health badge](/badges/jdlxnl-api-version/health.svg)

```
[![Health](https://phpackages.com/badges/jdlxnl-api-version/health.svg)](https://phpackages.com/packages/jdlxnl-api-version)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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