PHPackages                             shiftonelabs/laravel-singular-resource-routes - 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. [Framework](/categories/framework)
4. /
5. shiftonelabs/laravel-singular-resource-routes

ActiveLibrary[Framework](/categories/framework)

shiftonelabs/laravel-singular-resource-routes
=============================================

Adds support for singular resource routes to the Laravel router.

1.0.1(3y ago)2711.3k↓11.1%MITPHPPHP &gt;=5.5.0

Since Jan 14Pushed 3y ago2 watchersCompare

[ Source](https://github.com/shiftonelabs/laravel-singular-resource-routes)[ Packagist](https://packagist.org/packages/shiftonelabs/laravel-singular-resource-routes)[ Docs](https://github.com/shiftonelabs/laravel-singular-resource-routes)[ RSS](/packages/shiftonelabs-laravel-singular-resource-routes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (4)Used By (0)

laravel-singular-resource-routes
================================

[](#laravel-singular-resource-routes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/63c7b315dfdb90b07dbdc7cd01791b5ff6174d173c608202b98144cc9eb65df1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686966746f6e656c6162732f6c61726176656c2d73696e67756c61722d7265736f757263652d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shiftonelabs/laravel-singular-resource-routes)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)[![Build Status](https://camo.githubusercontent.com/f612bd218219950cda1f35568e77adc082466f7a254afb8bd82a9dbf7a32d179/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73686966746f6e656c6162732f6c61726176656c2d73696e67756c61722d7265736f757263652d726f757465732f2e6769746875622f776f726b666c6f77732f706870756e69742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/shiftonelabs/laravel-singular-resource-routes/actions)[![Coverage Status](https://camo.githubusercontent.com/3e982388bd888bc3132b8d5809fa8b6c08dada6597569be674fb4106836f3e66/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73686966746f6e656c6162732f6c61726176656c2d73696e67756c61722d7265736f757263652d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/shiftonelabs/laravel-singular-resource-routes/code-structure)[![Quality Score](https://camo.githubusercontent.com/b1f1a4e006bcdc2460bfea883fbd2f679d52f585b0a2bcfd01f70538f0f13fd5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73686966746f6e656c6162732f6c61726176656c2d73696e67756c61722d7265736f757263652d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/shiftonelabs/laravel-singular-resource-routes)[![Total Downloads](https://camo.githubusercontent.com/fa29200825719647ba5c6ae33c000a04ccd2ef62c6d0c926a8a7bd8dcebc6514/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686966746f6e656c6162732f6c61726176656c2d73696e67756c61722d7265736f757263652d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shiftonelabs/laravel-singular-resource-routes)

This Laravel package adds support for singular resource routes to Laravel's router.

Sometimes you need to deal with a resource that does not need to be referenced by the id. For example, you may have a `profile` resource that belongs to the currently authenticated user. Currently, if you wanted to `show` the user's profile, the route would be `/profile/{profile}`. However, since you don't need the id to look up the current user's profile, it would be nice to be able to simply have the `show` route be `/profile`. This is the same for the `edit`, `update`, and `destroy` routes, as well.

The singular resource route generates the following routes:

VerbPathActionRoute NameGET/profile/createcreateprofile.createPOST/profilestoreprofile.storeGET/profileshowprofile.showGET/profile/editeditprofile.editPUT/PATCH/profileupdateprofile.updateDELETE/profiledestroyprofile.destroyThese routes differ from the current resource routes in two ways:

1. The `show`, `edit`, `update`, and `destroy` routes do not need a route parameter.
2. Since this is a singular resource, there is no `index` action.

Versions
--------

[](#versions)

This package has been tested on Laravel 5.0 through Laravel 8.x, though it may continue to work on later versions as they are released. This section will be updated to reflect the versions on which the package has actually been tested.

Install
-------

[](#install)

Via Composer

```
composer require shiftonelabs/laravel-singular-resource-routes
```

Service Provider

This package supports Laravel package autodiscovery. So, if using Laravel 5.5+, there is no need to add the server provider. If using Laravel 5.0 - 5.4, add the service provider to your `config/app.php` file:

```
'providers' => [
    ...
    ShiftOneLabs\SingularResourceRoutes\SingularResourceRoutesServiceProvider::class,
];
```

Usage
-----

[](#usage)

In order to create a new singular resource route, a new `singular` option is added to the resource route definition. This option can be set to three different values:

1. The boolean `true`. This is mainly for non-nested resource definitions. If it is used on a nested resource definition, only the last resource in the chain will be treated as singular.
2. A string containing the name of the singular resource. This can be used when there is only one resource that is singular in a nested resource definition. The string must contain the name of the singular resource.
3. An array of strings containing the names of the singular resources. This format must be used when there are multiple singular resources in a nested resource definition, but it can be used in any scenario.

#### Code Example

[](#code-example)

**A singular resource (`/profile`):**

```
// Since there is only one singular resource, and it is the last one,
// all three options work in this scenario.

Route::resource('profile', 'ProfileController', ['singular' => true]);
Route::resource('profile', 'ProfileController', ['singular' => 'profile']);
Route::resource('profile', 'ProfileController', ['singular' => ['profile']]);

```

**A singular resource nested under a plural resource (`/users/{user}/profile`):**

```
// Since there is only one singular resource, and it is the last one,
// all three options work in this scenario.

Route::resource('users.profile', 'ProfileController', ['singular' => true]);
Route::resource('users.profile', 'ProfileController', ['singular' => 'profile']);
Route::resource('users.profile', 'ProfileController', ['singular' => ['profile']]);

```

**A singular resource nested under a singular resource (`/profile/avatar`):**

```
// Since there are multiple resources that are singular, only the array
// syntax can be used to specify all the singular resources.

Route::resource('profile.avatar', 'ProfileAvatarController', ['singular' => ['profile', 'avatar']]);

```

**A plural resource nested under a singular resource (`/profile/phones/{phone}`):**

```
// Since there is a parent resource that is singular, the "true" option cannot be used.
// But since there is only one singular resource, the string option can be used.

Route::resource('profile.phones', 'PhoneController', ['singular' => 'profile']);
Route::resource('profile.phones', 'PhoneController', ['singular' => ['profile']]);

```

**A singular resource nested under a plural resource nested under a singular resource (`/profile/phones/{phone}/type`):**

```
// Since there are multiple resources that are singular, only the array
// syntax can be used to specify all the singular resources.

Route::resource('profile.phones.type', 'PhoneTypeController', ['singular' => ['profile', 'type']]);

```

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

[](#contributing)

Contributions are welcome. Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Patrick Carlo-Hickman](https://github.com/patrickcarlohickman)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1910 days

Total

2

Last Release

1130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/359fc390650d98265cef526a899c6bc79cd9030e32d17a472af34f38ed70fb2c?d=identicon)[patrickcarlohickman](/maintainers/patrickcarlohickman)

---

Top Contributors

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

---

Tags

laravelroutessingularresource

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/shiftonelabs-laravel-singular-resource-routes/health.svg)

```
[![Health](https://phpackages.com/badges/shiftonelabs-laravel-singular-resource-routes/health.svg)](https://phpackages.com/packages/shiftonelabs-laravel-singular-resource-routes)
```

###  Alternatives

[laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

1.7k4.1M69](/packages/laravel-wayfinder)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.4k10.6M274](/packages/laravel-boost)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[htmlmin/htmlmin

HTMLMin Is A Simple HTML Minifier For Laravel 5

1.0k1.9M9](/packages/htmlmin-htmlmin)

PHPackages © 2026

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