Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Advanced Route Laravel Package

lesichkovm/laravel-advanced-route

An advanced route class for Laravel that extends the framework's default router, letting you register routes with multiple HTTP methods, domains, HTTPS constraints, middleware, and names in one fluent call. Keeps complex route definitions cleaner and easier to maintain.

View on GitHub
Deep Wiki
Context7

Getting Started

The package is a thin layer on top of Laravel's router that lets you collapse a block of repetitive controller routes into a single declaration and dispatch to controller methods by convention. It is small enough to read end-to-end before you commit, which is exactly what I'd do first.

Install

composer require lesichkovm/laravel-advanced-route

On Laravel 5.5+ package discovery picks up the service provider automatically. On older versions register it manually in config/app.php (provider + AdvancedRoute alias) — check the extra.laravel block in the package's composer.json for the exact class names, and the autoload.psr-4 block for the namespace root.

Where to look first, in this order

  1. composer.json — the illuminate/support constraint tells you immediately whether it works on your Laravel version. This is the single most important line in the repo.
  2. src/ — the provider plus one registrar class. The registrar is where the verb/path → controller-method resolution actually happens; read it before you write production routes against it.
  3. README.md — usage examples.
  4. php artisan route:list after your first registration — this is the ground truth for what the package actually registered, and it will answer most questions faster than the docs.

First use case

Replace an explicit CRUD block with one line. Instead of:

Route::get('posts', 'PostController@index')->name('posts.index');
Route::get('posts/create', 'PostController@create')->name('posts.create');
Route::post('posts', 'PostController@store')->name('posts.store');
Route::get('posts/{post}', 'PostController@show')->name('posts.show');
Route::get('posts/{post}/edit', 'PostController@edit')->name('posts.edit');
Route::put('posts/{post}', 'PostController@update')->name('posts.update');
Route::delete('posts/{post}', 'PostController@destroy')->name('posts.destroy');

you declare the resource once and let the package map verb + URI onto index / create / store / show / edit / update / destroy on PostController. Verify the method names it expects against src/ — the convention is the contract, and getting it wrong yields 404s or MethodNotAllowed, not a helpful error.

Implementation Patterns

Register advanced routes last. These declarations are greedy by nature. Put them in a dedicated group at the bottom of routes/web.php (or your module's route file) so that explicit, named routes higher up win the match. If a route suddenly 404s after adding an advanced route, ordering is the first thing to check.

Wrap in a group for shared concerns. The package registers routes; it does not inherit your RouteServiceProvider middleware for free.

Route::middleware(['web', 'auth'])
    ->prefix('admin')
    ->name('admin.')
    ->group(function () {
        // advanced route declarations here
    });

This is also the cleanest way to apply auth, can: or throttle middleware per section without patching the package.

Use it for the boring 80%, not the interesting 20%. It shines on standard resource-shaped controllers. As soon as a route needs a custom name, a custom binding, a custom where() constraint, or a non-conventional method, write it out explicitly. Mixing the two styles in one file is normal and fine — just keep the explicit ones above the advanced block.

Combine with route model binding. Because the resolved method receives the route parameters like any other action, implicit binding on {post} works as long as the parameter name in your URI matches the type-hinted variable. This is the main reason to keep the URI patterns conventional.

Test at the HTTP layer, not the routing layer. Feature tests are the right safety net because the mapping is implicit:

public function test_update_route_reaches_controller(): void
{
    $this->actingAs($user)
        ->put('/posts/1', ['title' => 'x'])
        ->assertOk();
}

A single smoke test per verb catches convention drift when you upgrade the package or Laravel.

Namespace resolution. On Laravel 8+ there is no automatic App\Http\Controllers prefix. Use fully-qualified controller class strings (PostController::class) in your declarations rather than the old string form — it survives the namespace change, gives you IDE navigation, and fails loudly at the declaration site instead of at dispatch.

Gotchas and Tips

  • Low-traffic package, read the source. 70 stars and a single maintainer means the README is not exhaustive. Budget ten minutes to read the registrar; it will pay for itself the first time a route behaves unexpectedly.
  • Route caching. php artisan route:cache freezes whatever was resolved. Always php artisan route:clear after editing declarations, and add it to your deploy script. If caching misbehaves, disable it temporarily to confirm the package isn't the cause.
  • Greedy wildcards swallow fallbacks. If you pair an advanced route with a {any}-style catch-all, order matters and the catch-all must be absolutely last. Debug with php artisan route:list -v to see the registration order Laravel actually holds.
  • A missing controller method is a runtime failure, not a boot failure. Nothing validates that PostController@patchThing exists until a request arrives. Consider a small test that iterates the expected verbs against each advanced route, or accept that 500s are your discovery mechanism.
  • Middleware is not inherited. Auth-protected areas will silently be public if you forget the group. Verify with an unauthenticated request in a test, not by eye.
  • Verb coverage. HEAD/OPTIONS and any Route::any-style behaviour are worth explicitly probing with curl -X OPTIONS if you have CORS or preflight requirements.
  • Upgrade risk is low but real. The code surface is tiny, so the worst case is vendoring the one class into app/Support/ and dropping the dependency. Keep that escape hatch in mind rather than treating this as infrastructure you can't remove.
  • Extension point: the service provider is your hook. If you need a different convention (say, suffix-based method names), subclass or copy the registrar and register your own — cheaper than fighting the package's assumptions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package