poshtive/router

Convention-based route discovery for Laravel controllers using PHP attributes.

Maintainers

Package info

github.com/poshtive/laravel-router

Type:laravel-package

pkg:composer/poshtive/router

Transparency log

Statistics

Installs: 410

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.0 2026-07-03 03:04 UTC

This package is auto-updated.

Last update: 2026-07-11 14:09:35 UTC


README

Convention-based route discovery for Laravel controllers, with PHP attributes for overrides and metadata.

Status

Tests codecov

laravel-router is stable.

  • PHP: ^8.3
  • Laravel components: ^13.0
  • Test coverage: PHPUnit 11 + Orchestra Testbench 11, with src/ at 100% locally

Highlights

  • Public-method route discovery with minimal registration boilerplate
  • Support for nested controller resources and model-bound parameters
  • Convention-based HTTP verb resolution with optional explicit overrides
  • Middleware, where constraints, and inheritance-aware discovery
  • Strict duplicate detection and optional skipped-route reporting

Installation

Install the package with Composer:

composer require poshtive/router

Optionally publish the configuration file:

php artisan vendor:publish --provider="Poshtive\Router\RouterServiceProvider" --tag="config"

Quick Start

Configure route discovery in config/router.php:

'groups' => [
    'web' => [
        'paths' => [app_path('Http/Controllers')],
        'middleware' => ['web'],
    ],
],

Then add a controller method:

namespace App\Http\Controllers;

class UserController
{
    public function index() {}
}

This registers GET /user automatically after the service provider boots.

You can still define Laravel routes manually as usual.

Documentation

Testing

Run the package test suite with:

composer test

Generate a Clover coverage report for src/ with:

composer test:coverage

Changelog

Release notes are tracked in CHANGELOG.md.

Contributing

Contributions are welcome. Please feel free to submit issues or pull requests.

License

This package is open-sourced software licensed under the MIT license.