PHPackages                             saberyjs/tp5-route-helper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. saberyjs/tp5-route-helper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

saberyjs/tp5-route-helper
=========================

this library can helper to build tp5 route rule

2.2.1(8y ago)114MITPHPPHP &gt;5.6

Since Mar 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/SABERYJS/tp5-route-helper)[ Packagist](https://packagist.org/packages/saberyjs/tp5-route-helper)[ RSS](/packages/saberyjs-tp5-route-helper/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (5)Used By (0)

thinkphp5-route-helper
======================

[](#thinkphp5-route-helper)

this library help register route auto, write less,make develop better

introduce
---------

[](#introduce)

if you have ever use thinkphp5 route ,you will feel exhausted ,because if you want register route rule,you must provide it in a file called route.php (maybe call some other name), so i write this tool,its his role like JAVA web route.

how to use
----------

[](#how-to-use)

it is very easy to use this library.

- create object of **RouterHelper**
- call method called **register**

code is here:

```
$routeHelper = new \saberyjs\tp_route_helper\RouterHelper();
$routeHelper->register([
    ['index',APP_PATH]
]);
```

what you need is create a instance of *RouterHelper*,and call *register* method on it

how to define class or method
-----------------------------

[](#how-to-define-class-or-method)

to use this library ,you must provide some annotation when you write your controller, assuming we want write a controller class called *User*:

```
/**
 * @auto true
 * @https false
 * **/
class Index
{
    /**
     * @rule /home/:id/:token
     * @alias home
     * @https false
     * @method get|post
     * @ext html|shtml
     * @deny_ext  htm
     * @constraint  id  \d{1,5} token  \w+
     * **/
    public function index($id)
    {
        echo  Route::class;
    }
}
```

code is very simple,the annotation of *getOrder* explain that this method should request by GET or POST, and http protocal should be https,last,param id should only be number(max length is 4),if you do not remember thinkphp5 route ,you should read it first.

some tips
---------

[](#some-tips)

when you create RouteHelper,you can provide two args,*$namespace* and *Parser*,$namespace specify base namespace,but you may not provide because library provide a default value(app,it`s value is equal *APP\_NAMESPACE* constant). $parser is a obejct that implement Parser interface,more detail,please look for [AnnotationHeper](https://github.com/SABERYJS/php-annotation-helper),it is responsible for parse annotation for php code.

cache routes
------------

[](#cache-routes)

in production environment,route rules is cached,actually,it depends on a config item called **app\_debug**,if it`s value is equal to false,rules will be cached in the path(RUNTIME\_PATH/routes.json).

contact
-------

[](#contact)

email: QQ:1174332406

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2984d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f7b897e9d511c9b7b437dbb15ecf7d2e5b48e1d7c238bb5b51e2ee639d0e9248?d=identicon)[saberyjs](/maintainers/saberyjs)

---

Top Contributors

[![SABERYJS](https://avatars.githubusercontent.com/u/12248909?v=4)](https://github.com/SABERYJS "SABERYJS (10 commits)")[![freedevcode](https://avatars.githubusercontent.com/u/201516844?v=4)](https://github.com/freedevcode "freedevcode (1 commits)")

### Embed Badge

![Health badge](/badges/saberyjs-tp5-route-helper/health.svg)

```
[![Health](https://phpackages.com/badges/saberyjs-tp5-route-helper/health.svg)](https://phpackages.com/packages/saberyjs-tp5-route-helper)
```

###  Alternatives

[kbs1/laravel-abbreviations

Abbreviations / acronyms support for your app.

1018.6k](/packages/kbs1-laravel-abbreviations)

PHPackages © 2026

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