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 2mo 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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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://www.gravatar.com/avatar/480f9a45ea8e9d3c7cf626fab980bd58e677a89911dc6453595d4212b905abfa?d=identicon)[kirillsimin](/maintainers/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

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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