PHPackages                             kirillsimin/semaphore - 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. kirillsimin/semaphore

ActiveLibrary[API Development](/categories/api)

kirillsimin/semaphore
=====================

Versioned routes for Laravel API resources

215PHP

Since Sep 24Pushed 7y ago1 watchersCompare

[ Source](https://github.com/kirillsimin/semaphore)[ Packagist](https://packagist.org/packages/kirillsimin/semaphore)[ RSS](/packages/kirillsimin-semaphore/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

**Semaphore**
=============

[](#semaphore)

### Versioned routes for Laravel's API resources

[](#versioned-routes-for-laravels-api-resources)

### **Installation**

[](#installation)

Require this package with composer:

```
composer require kirillsimin/semaphore

```

Laravel 5.5+ uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you want to use the facade in your routes, add this to your facades in app.php:

`'VersionedRoute' => Kirillsimin\Semaphore\VersionedRoute::class,`

#### **Laravel 5.5+:**

[](#laravel-55)

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

`KirillSimin\Semaphore\ServiceProvider::class,`

Copy the package config to your local config with the publish command:

`php artisan vendor:publish --provider="Kirillsimin\Semaphore"`

### **Usage**

[](#usage)

1. Create the default version of your API resource controller from an existing one:

- Create a folder with the name of the API resource controller you want to version. For example, if you are versioning `app/Http/Controllers/PhotosController.php`, create this folder: `app/Http/Controllers/PhotosController/`.
- Rename `PhotosController.php` into `PhotosController_v0.php`
- Change the class name to `PhotosController_v0`
- Update the namespace and include the base controller (`use App\Http\Controllers\Controller;`).

2. Create the next version:

- Create `PhotosController_v1.php` in the same folder
- Call the class `PhotosController_v1` and make sure it `extends PhotosController_v0`
- Overwrite any methods you wish to update. All other methods will be called from the previous version.

3. Update your routes file.

- In your routes/api.php, either include the package at the top (`use KirillSimin\Semaphore\VersionedRoute`), or use an alias in your `app.php`
- Replace `Route::apiResource('photos', 'PhotosController');` with `VersionedRoute::apiResource('photos', 'PhotosController')`

4. Make the call to the correct controller:

- The route accepts a custom `controller-version` header. If you do not pass it, it will default to `_v0`. If you pass a number, it will attempt to locate the correct version of the controller.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14960960?v=4)[Kirill Simin](/maintainers/kirillsimin)[@kirillsimin](https://github.com/kirillsimin)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/kirillsimin-semaphore/health.svg)

```
[![Health](https://phpackages.com/badges/kirillsimin-semaphore/health.svg)](https://phpackages.com/packages/kirillsimin-semaphore)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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