PHPackages                             orluweliaugustine-ctrl/laravel-yml-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. [API Development](/categories/api)
4. /
5. orluweliaugustine-ctrl/laravel-yml-routes

ActiveLibrary[API Development](/categories/api)

orluweliaugustine-ctrl/laravel-yml-routes
=========================================

Create laravels routes by editing simple YAML Files

00PHP

Since Oct 6Pushed 7mo agoCompare

[ Source](https://github.com/orluweliaugustine-ctrl/laravel-yml-routes)[ Packagist](https://packagist.org/packages/orluweliaugustine-ctrl/laravel-yml-routes)[ RSS](/packages/orluweliaugustine-ctrl-laravel-yml-routes/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel YAML Routes
===================

[](#laravel-yaml-routes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5da3147b6de48253cf880a0072af16deab1c25bfc7de91837bfc025133ea7f69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62726f7377696c6c692f6c61726176656c2d796d6c2d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/broswilli/laravel-yml-routes)[![Total Downloads](https://camo.githubusercontent.com/1eee8d1a2df250530d93e686e474b0ccc3936b0a71ebc15844dfaf975083eb0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62726f7377696c6c692f6c61726176656c2d796d6c2d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/broswilli/laravel-yml-routes)

This package is created for Laravel Developers to create routes using YAML files. This package makes it easy for many routes to be created and arranged with well organized prefixes and middleware.

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

[](#installation)

You can install the package via composer:

```
composer require orluweliaugustine-ctrl/laravel-yml-routes
```

#### You can publish configuration files

[](#you-can-publish-configuration-files)

```
php artisan vendor:publish --tag laravel-yml-routes-config
```

#### Edit the Root YAML File:

[](#edit-the-root-yaml-file)

```
resource_1:
  file: admin.yaml
  prefix: admin
  middleware: ['can:isAdmin']
```

Create a yaml file of choice for the sake of this example create admin.yaml file in the same directory as the root.yaml file

```
admin_org:
  path: /org
  controller: [Adapt\SchAdmin\Http\Controllers\Administration\OrganizationController]
  methods: ['resource']
```

#### Output routes in the routes.php file

[](#output-routes-in-the-routesphp-file)

```
\Orluweliaugustine-ctrl\LaravelYmlRoutes\LaravelYmlRoutesFacade::createRoutes();
```

Usage
-----

[](#usage)

#### Edit the root YAML file

[](#edit-the-root-yaml-file-1)

```
resource_1:
  file: example.yaml
  prefix: front
  middleware: ['auth', 'can:isAdmin', auth]
resource_2:
  file: example2.yaml
  prefix: admin,
  name: admin
  middleware: ['guest']
resource_3:
  path: /root-test
  controller: [Adapt\SchAdmin\Http\Controllers\SampleController, index]
  methods: ['get']
resource_4:
  path: /root-invoke
  controller: [Adapt\SchAdmin\Http\Controllers\InvokableController]
  methods: ['get']
```

From the YAML above the root nodes resource\_1 and resource\_2 points to other yaml files that describes a group of routes. The root nodes resource\_3 and resource\_4 creates 2 new routes with url example.com/root-test and example.com/root-invoke.

example.yaml

```
test_resource:
  path: /test
  controller: [Adapt\SchAdmin\Http\Controllers\SampleController, index]
  methods: ['get']
test_resource_2:
  path: /resc
  controller: [Adapt\SchAdmin\Http\Controllers\ResourceController]
  methods: ['resource']
test_resource_3:
  path: /api
  controller: [Adapt\SchAdmin\Http\Controllers\ResourceController]
  methods: ['apiResource']
test_invokable:
  path: /invoke
  controller: [Adapt\SchAdmin\Http\Controllers\InvokableController]
  methods: ['get']
```

All urls from example.yaml will have a prefix of front and a common middleware of 'can:isAdmin' applied:

- example.com/front/test
- example.com/front/invoke

The front prefix and the middleware was defined in the root.yaml file

#### Route Names and Methods

[](#route-names-and-methods)

- test\_resource
    - Route Name(s): test\_resource
    - Method(s): GET
    - Controller Class: Adapt\\SchAdmin\\Http\\Controllers\\SampleController
    - Action: index
- test\_resource\_2
    - Route Names(s): resc.index, resc.store, resc.create, resc.show, resc.edit, resc.update, resc.destroy
    - Methods: GET, POST, PUT, DELETE
    - Controller Class: Adapt\\SchAdmin\\Http\\Controllers\\ResourceController
- test\_resource\_3: This is similar to test\_resource\_2 suitable for restful API's. It comes without routes for the create, and edit actions which are not needed for restfull API's
- test\_invokable: A controller that has the \_\_invoke method or a single action controller. You can create the route without stating the action

Please visit  to know more about resource controllers.

Visit  to know more about API Resource.

Visit  to know more about single action controllers

#### Route Prefixes

[](#route-prefixes)

The example2.yaml is used to demonstrate route prefixes. In the root.yaml file it was referenced as follows:

```
resource_2:
  file: example2.yaml
  prefix: admin,
  name: admin
  middleware: ['guest']
```

example2.yaml

```
admin-index:
  path: /
  controller: [Adapt\SchAdmin\Http\Controllers\AdminController, index]
  methods: ['get']
```

The root.yaml file where the example2 routes were defined has a node with a key of name. The function of the name node is to create route name prefix.

- admin-index
    - Route Name(s): admin.admin-index
    - Method(s): GET
    - Controller Class: Adapt\\SchAdmin\\Http\\Controllers\\AdminController
    - Action: index

Notice that the Route Name is admin.admin-index instead of admin-index because of the name node defined in the root.yaml file

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

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)

- [Weli Orlu](https://github.com/orluweliaugustine-ctrl)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance45

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/53f0002409f33954a45fc8058e3e40c60775c776befeb12d7f17cea4ab063859?d=identicon)[broswilli](/maintainers/broswilli)

---

Top Contributors

[![broswilli](https://avatars.githubusercontent.com/u/1294802?v=4)](https://github.com/broswilli "broswilli (18 commits)")

### Embed Badge

![Health badge](/badges/orluweliaugustine-ctrl-laravel-yml-routes/health.svg)

```
[![Health](https://phpackages.com/badges/orluweliaugustine-ctrl-laravel-yml-routes/health.svg)](https://phpackages.com/packages/orluweliaugustine-ctrl-laravel-yml-routes)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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