PHPackages                             seymennc/php-route - 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. seymennc/php-route

ActiveLibrary

seymennc/php-route
==================

00PHP

Since Sep 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/seymennc/PHP-Route)[ Packagist](https://packagist.org/packages/seymennc/php-route)[ RSS](/packages/seymennc-php-route/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Route Library
=================

[](#php-route-library)

The PHP Route Library allows you to define HTTP-based routes quickly and flexibly. It is designed especially for use in MVC structures. It offers advanced features like flexible route definitions, middleware integration, and named routes.

Badges
------

[](#badges)

[![Latest Stable Version](https://camo.githubusercontent.com/38df18b60b36d81228c88ca7b50e5ed273218df8d77925a60356743342b73862/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f763f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

[![Total Downloads](https://camo.githubusercontent.com/ba645fd93f190cf91bf9eccdbdea31a571420263a6768741a3ec3839f9db6dcc/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

[![Latest Unstable Version](https://camo.githubusercontent.com/13c6b830489ad9608a9d9758e3190a07e5e960d1a073dd5a5d39688bd11415ee/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f762f756e737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

[![License](https://camo.githubusercontent.com/517012f336bd622a30b57d2ff02ec81b8bcaf1df8ad92e03bfa3b8b4087f37de/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

[![PHP Version Require](https://camo.githubusercontent.com/81f2878fe2803efb789a7c2bea276164c44f421b3778783a9da65724ce871532/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f726571756972652f7068703f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

[![Version](https://camo.githubusercontent.com/0b2b05c12704eeaae26acf3b5dd3eddf5176142d8318d6a485bc85863c79eab3/68747470733a2f2f706f7365722e707567782e6f72672f7365796d656e6e632f7068702d726f7574652f76657273696f6e3f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/seymennc/asgard)

🔗 Links
-------

[](#-links)

[![portfolio](https://camo.githubusercontent.com/ee59c11a0ffcc301e7d0b1201866923b89c43bfd5701d3a45eef9372794dc301/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d795f706f7274666f6c696f2d3030303f7374796c653d666f722d7468652d6261646765266c6f676f3d6b6f2d6669266c6f676f436f6c6f723d7768697465)](https://seymencayir.com.tr/)[![linkedin](https://camo.githubusercontent.com/9745a59ad4a919d2e524512c3f732c820d4aa0fe927def4f37c4aba08f7e42bc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e6b6564696e2d3041363643323f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e266c6f676f436f6c6f723d7768697465)](https://www.linkedin.com/in/seymennc)[![twitter](https://camo.githubusercontent.com/79cbea7e1aa9ec614d34050bdc4128542d8527807ac8ce879f953ced3478375d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f747769747465722d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d74776974746572266c6f676f436f6c6f723d7768697465)](https://twitter.com/benseymenemen)

Features
--------

[](#features)

- **HTTP Method Support:** Supports HTTP requests like GET, POST, PUT, DELETE, and more.
- **Route Grouping:** Group similar routes to create a more organized and cleaner structure.
- **Prefix Support:** Add a prefix to all routes to create dynamic and organized route structures.
- **Middleware:** Define middleware for each route to control requests before or after processing.
- **Named Routes:** Name your routes to simplify dynamic URL generation.
- **Dynamic Route Patterns:** Build flexible structures with route parameters.

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

[](#installation)

To use the project, follow these steps:

### Git Clone

[](#git-clone)

```
git clone https://github.com/seymennc/php-route.git
```

```
cd php-route
```

```
php -S 127.0.0.1:8080
```

### Composer

[](#composer)

#### If you create new project with php-router

[](#if-you-create-new-project-with-php-router)

```
composer create-project seymennc/php-route php-route
```

```
cd php-route
```

```
php -S 127.0.0.1:8080
```

#### If you will only use it in your project

[](#if-you-will-only-use-it-in-your-project)

```
composer require seymennc/php-route
```

Usage
-----

[](#usage)

Include the autoloader in your project:

```
require 'vendor/autoload.php';
```

Then, include the web.php file in your project:

```
require __DIR__ . '/web/web.php';
```

Finally, add dispatch the routes:

```
Route::dispatch();
```

### Basic Usage

[](#basic-usage)

You can define your routes in the web.php file.

This method defines a route that responds to GET requests to the /home URL. The function returns the string 'Home Page' when the route is accessed.

#### Basic GET Route

[](#basic-get-route)

```
use Luminance\Service\phproute\Route\Route;

Route::method('get')->route('/home', function() {
    return 'Home Page';
})->name('home');
```

#### Basic POST Route

[](#basic-post-route)

In addition to the home URL, let's add a new route that responds to POST requests. When the route is accessed, the function returns the string 'Post Page'.

```
Route::method('post')->route('/home', function() {
    return 'Home Post Page';
})->name('home');
```

#### With Controller

[](#with-controller)

You can also define routes that respond to requests with a controller. In this example, the route responds to GET requests to the /about URL. When the route is accessed, the AboutController class's index method is called.

```
Route::method('get')->route('/home', 'AboutController@index')->name('about');
```

#### With Middleware

[](#with-middleware)

You can define middleware for each route. In this example, the route responds to GET requests to the /contact URL. When the route is accessed, the function returns the string 'Contact Page'. The middleware function is called before the route is processed.

```
Route::method('get')->route('/contact', function() {
    return 'Contact Page';
})->middleware('auth')->name('contact');
```

#### Route Grouping and Prefix

[](#route-grouping-and-prefix)

You can group similar routes to create a more organized and cleaner structure. In this example, the routes are grouped under the /admin prefix. The routes respond to GET requests to the /admin/dashboard and /admin/profile URLs.

```
Route::prefix('/admin')->group(function() {
    Route::method('get')->route('/dashboard', 'AdminController@index');
    Route::method('post')->route('/profile', 'AdminController@profile');
});
```

More examples will be found in the [Asgard Docs](https://seymencayir.com.tr/asgard/docs/).

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

[](#contributing)

We welcome contributions! If you find a bug or have suggestions for improvements, please open an issue or contribute directly to the project.

Our ♥️ Contributors
-------------------

[](#our-️-contributors)

[ ![](https://camo.githubusercontent.com/b668c2bca1360a6808d244ebba39785713b000f7ac2f70820e8891436c7d1d8d/68747470733a2f2f636f6e747269622e726f636b732f696d6167653f7265706f3d7365796d656e6e632f5048502d526f757465)](https://github.com/seymennc/PHP-Route/graphs/contributors)License
-------

[](#license)

Licensed under the GNU GENERAL PUBLIC LICENSE, Copyright © 2024-present BLC Studio

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

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/9bc18b98258be17c4a26c11b7a636e9ed69ad2348770b9545a6723d4a9deb1ec?d=identicon)[seymennc](/maintainers/seymennc)

---

Top Contributors

[![seymennc](https://avatars.githubusercontent.com/u/34661856?v=4)](https://github.com/seymennc "seymennc (8 commits)")

### Embed Badge

![Health badge](/badges/seymennc-php-route/health.svg)

```
[![Health](https://phpackages.com/badges/seymennc-php-route/health.svg)](https://phpackages.com/packages/seymennc-php-route)
```

PHPackages © 2026

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