New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

eyf/laravel-autoroute

Laravel YAML routes
1,936 5

Larablocks Analysis

eyf/laravel-autoroute works with any PHP project: the latest release (v2.0.0, Sep 15, 2022) doesn't depend on Laravel.

Laravel 5 in earlier releases.

Promising: maintained and up to date, meets 1 of 3 checks; not yet widely used.

  • Pre-release in the last 12 months (Feb 26, 2026); last stable Sep 15, 2022
  • 45 downloads a month (needs 10,000)
  • 5 GitHub stars (needs 100)

State

In pre-release
  • Last stable release: Sep 15, 2022.
  • Latest pre-release: v3.0.0-alpha.20, Feb 26, 2026.
  • 1 release in the last 12 months, a pre-release.
  • First released: Jan 29, 2016.
  • Monthly downloads: 45.
  • 1 open issue on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 29, 2026.

Install
composer require eyf/laravel-autoroute
Latest Version:v2.0.0
PHP:>=7.2.5
Older releases:5
License:MIT
Last Updated:Feb 26, 2026
Links: GitHub  ·  Packagist
Maintainer: eyf

laravel-autoroute

Autoroute helps you register Laravel routes as YAML.

"La route? Là où on va, on a pas besoin... De route."

Install

composer require eyf/laravel-autoroute

Usage

<?php
// app/Providers/RouteServiceProvider.php

use Eyf\Autoroute\Autoroute;

class RouteServiceProvider extends ServiceProvider
{
    public function map(Autoroute $autoroute)
    {
        $autoroute->load(["api.yaml"]);
    }
}

Note: It will automatically look for files inside the Laravel routes/ folder.

Sample api.yaml

domain: api.example.org
prefix: v1
middleware:
    - api
namespace: App\Http\Controllers\Api
paths:
    "users":
        get:
            uses: UserController@index

        post:
            uses: UserController@store

    "users/{id}":
        get:
            uses: UserController@find

        put:
            uses: UserController@update

Or using the compact syntax:

domain: api.example.org
prefix: v1
middleware:
    - api
namespace: App\Http\Controllers\Api
paths:
    "users":
        get: user.index
        post: user.store

    "users/{id}":
        get: user.find
        put: user.update

Template parameters

Autoroute supports light parameters in YAML files. The format is %<parameter_name>%.

For instance let's say you need to work with a local API subdomain:

<?php
// app/Providers/RouteServiceProvider.php

use Eyf\Autoroute\Autoroute;

class RouteServiceProvider extends ServiceProvider
{
    public function map(Autoroute $autoroute)
    {
        $parameters = [
            "app_domain" => env("APP_DOMAIN", "example.org"),
        ];

        $autoroute->load(["api.yaml"], $parameters);
    }
}

And in your local .env file:

APP_DOMAIN=localhost:8000
# APP_DOMAIN=example.org # PROD

And in your api.yaml file:

domain: api.%app_domain%
prefix: v1
# ...

Default route names

If you don't provide an as option in your route definition:

"users/{id}":
    get:
      uses: UserController@find
        as: my_user_find_route_name

Autoroute will generate a default route name based on the current namespace, controller and action names:

"users/{id}":
    get:
        uses: UserController@find
        # as: api.user.find (generated)

Custom default route name

If you're not happy with the default route name format, you can implement your own Eyf\Autoroute\RouteNamerInterface and bind it accordingly in your Laravel app service provider:

<?php
// app/Providers/AppServiceProvider.php

use Eyf\Autoroute\RouteNamerInterface;
use App\Services\MyRouteNamer;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->bind(RouteNamerInterface::class, MyRouteNamer::class);
    }
}

uses compact syntax

If you're not using any route options (as, etc...), you can use a "compact" syntax to specify your controllers:

domain: api.%app_domain%
prefix: v1
middleware:
    - api
namespace: App\Http\Controllers\Api
paths:
    "users":
        get: user.index
        post: user.store

    "users/{id}":
        get: user.find
        put: user.update

Custom compact syntax

You can customize the shorthand syntax by implementing RouteNamerInterface::getUses(string $compact).

Related Packages

eusonlito/laravel-simple-route

A package to create basic routes based in locales

112 0
laravel/folio

Page based routing for Laravel.

886,000 609
inmanturbo/turbohx

Send HTMX hx-post, put, patch and delete requests to your laravel/folio routes.

6,177 2
delormejonathan/laravel-js-routing

Laravel 4/5 package to access Routing from Javascript

1,018 7
babanesma/laravel5-routing

Laravel5 routing package

14 0

Version History

Version Released PHP Laravel License
v2.0.0 >=7.2.5 MIT
v1.0.0 >=7.2.5 MIT
v0.5.3 >=7.0 MIT
v0.5.2 >=7.0 MIT
v0.5.1 >=7.0 MIT
Pre-releases (21)
Version Released PHP License
v3.0.0-alpha.20 >=7.2.5 MIT
v3.0.0-alpha.19 >=7.2.5 MIT
v3.0.0-alpha.18 >=7.2.5 MIT
v3.0.0-alpha.17 >=7.2.5 MIT
v3.0.0-alpha.16 >=7.2.5 MIT