PHPackages                             thejawker/laravel-route-module-macro - 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. thejawker/laravel-route-module-macro

ActiveLibrary[API Development](/categories/api)

thejawker/laravel-route-module-macro
====================================

Exposes a module concept to enforce a CRUD and Restful way of routing and naming convention.

0.1.3(6y ago)36951[2 PRs](https://github.com/thejawker/laravel-route-module-macro/pulls)MITPHPPHP ^7.0

Since Sep 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/thejawker/laravel-route-module-macro)[ Packagist](https://packagist.org/packages/thejawker/laravel-route-module-macro)[ Docs](https://github.com/thejawker/laravel-route-module-macro)[ RSS](/packages/thejawker-laravel-route-module-macro/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (7)Dependencies (8)Versions (11)Used By (0)

Exposes a module concept to enforce a CRUD and Restful way of routing and naming convention.
============================================================================================

[](#exposes-a-module-concept-to-enforce-a-crud-and-restful-way-of-routing-and-naming-convention)

[![Latest Version on Packagist](https://camo.githubusercontent.com/da9510a2335eacd3fe4c579d0c6394f20ccd46602a854bb0a2bd84a3d65d21d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468656a61776b65722f6c61726176656c2d726f7574652d6d6f64756c652d6d6163726f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thejawker/laravel-route-module-macro)[![Build Status](https://camo.githubusercontent.com/075662f37eec340e1cc6d9cbf6a20ee009703bb01bf5fa42edb28480cc0894ab/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468656a61776b65722f6c61726176656c2d726f7574652d6d6f64756c652d6d6163726f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thejawker/laravel-route-module-macro)[![Quality Score](https://camo.githubusercontent.com/9bf871a314905acef06ed1d4a1f94c74ebc0646759d14a5f873b2f4fb42ff556/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468656a61776b65722f6c61726176656c2d726f7574652d6d6f64756c652d6d6163726f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thejawker/laravel-route-module-macro)[![Total Downloads](https://camo.githubusercontent.com/c981bed04d45225fac497643ead7739a336821aa1c4ec454be3066d6b7a5f88e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468656a61776b65722f6c61726176656c2d726f7574652d6d6f64756c652d6d6163726f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thejawker/laravel-route-module-macro)

This package works with Laravel 5.5. It is very much inspired by the great [Freek van der Herten](https://twitter.com/freekmurze) with their [Blender Package](https://github.com/spatie/blender/blob/master/app/Providers/RouteServiceProvider.php), where he has a Macro for a module. This really resonates with the CRUD/Restful approach on routing.

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

[](#installation)

Require the package from Composer:

```
composer require thejawker/laravel-route-module-macro
```

As of Laravel 5.5 it will magically register the package.

Usage
-----

[](#usage)

You can add `Route::module('name', ['only'](optional), ['options](optional))` in any of your routes files. The second parameter will allow you to `only` use specific actions, and the third being general options. Refer to the [Laravel docs](https://laravel.com/docs/5.4/controllers#resource-controllers) for those.

### Examples:

[](#examples)

#### Full Resource

[](#full-resource)

routes/api.php

```
Route::module('posts');
```

```
$ php artisan route:list
+-----------+-----------------------------------------+---------------+---------------------------------------------------------------------------+
| Method    | URI                                     | Name          | Action                                                                    |
+-----------+-----------------------------------------+---------------+---------------------------------------------------------------------------+
| POST      | api/posts                               | posts.store   | App\Http\Controllers\PostsController@store                                |
| GET|HEAD  | api/posts                               | posts.index   | App\Http\Controllers\PostsController@index                                |
| GET|HEAD  | api/posts/create                        | posts.create  | App\Http\Controllers\PostsController@create                               |
| DELETE    | api/posts/{post}                        | posts.destroy | App\Http\Controllers\PostsController@destroy                              |
| PUT|PATCH | api/posts/{post}                        | posts.update  | App\Http\Controllers\PostsController@update                               |
| GET|HEAD  | api/posts/{post}                        | posts.show    | App\Http\Controllers\PostsController@show                                 |
| GET|HEAD  | api/posts/{post}/edit                   | posts.edit    | App\Http\Controllers\PostsController@edit                                 |
+-----------+-----------------------------------------+---------------+---------------------------------------------------------------------------+
```

#### Only Resource

[](#only-resource)

routes/api.php

```
Route::module('posts', ['store']);
```

```
$ php artisan route:list
+-----------+-----------------------------------------+---------------+----------------------------------------------------------------------------+
| Method    | URI                                     | Name          | Action                                                                     |
+-----------+-----------------------------------------+---------------+----------------------------------------------------------------------------+
| POST      | api/posts                               | posts.store   | App\Http\Controllers\PostsController@store                                 |
+-----------+-----------------------------------------+---------------+----------------------------------------------------------------------------+
```

#### Nested Resources

[](#nested-resources)

This will enforce you to write Controllers that make sense. A nested `users.posts` will require you to create a UserPostsController with the required actions. routes/api.php

```
Route::module('users.posts');
```

```
$ php artisan route:list
+-----------+-----------------------------------------+---------------------+----------------------------------------------------------------------------+
| Method    | URI                                     | Name                | Action                                                                     |
+-----------+-----------------------------------------+---------------------+----------------------------------------------------------------------------+
| POST      | api/users/{user}/posts                  | users.posts.store   | App\Http\Controllers\UserPostsController@store                             |
| GET|HEAD  | api/users/{user}/posts                  | users.posts.index   | App\Http\Controllers\UserPostsController@index                             |
| GET|HEAD  | api/users/{user}/posts/create           | users.posts.create  | App\Http\Controllers\UserPostsController@create                            |
| DELETE    | api/users/{user}/posts/{post}           | users.posts.destroy | App\Http\Controllers\UserPostsController@destroy                           |
| PUT|PATCH | api/users/{user}/posts/{post}           | users.posts.update  | App\Http\Controllers\UserPostsController@update                            |
| GET|HEAD  | api/users/{user}/posts/{post}           | users.posts.show    | App\Http\Controllers\UserPostsController@show                              |
| GET|HEAD  | api/users/{user}/posts/{post}/edit      | users.posts.edit    | App\Http\Controllers\UserPostsController@edit                              |
+-----------+-----------------------------------------+---------------------+----------------------------------------------------------------------------+
```

Test
----

[](#test)

This package definitely needs some extensive testing.

```
composer test
```

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.7% 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 ~104 days

Recently: every ~182 days

Total

8

Last Release

2484d ago

PHP version history (2 changes)0.0.1PHP ^7.0

0.0.2PHP &gt;=7.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6703837?v=4)[Bram Veerman](/maintainers/thejawker)[@thejawker](https://github.com/thejawker)

---

Top Contributors

[![thejawker](https://avatars.githubusercontent.com/u/6703837?v=4)](https://github.com/thejawker "thejawker (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

thejawkerroute-modulelaravel-route-module-macro

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thejawker-laravel-route-module-macro/health.svg)

```
[![Health](https://phpackages.com/badges/thejawker-laravel-route-module-macro/health.svg)](https://phpackages.com/packages/thejawker-laravel-route-module-macro)
```

###  Alternatives

[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M23](/packages/yajra-laravel-oci8)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M123](/packages/roots-acorn)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k11.8M113](/packages/nuwave-lighthouse)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8465.5M96](/packages/laravel-doctrine-orm)

PHPackages © 2026

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