PHPackages                             codelego/phpfox-router - 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. [Framework](/categories/framework)
4. /
5. codelego/phpfox-router

ActiveLibrary[Framework](/categories/framework)

codelego/phpfox-router
======================

Router library for phpfox framework

0161PHP

Since Nov 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/codelego/phpfox-router)[ Packagist](https://packagist.org/packages/codelego/phpfox-router)[ RSS](/packages/codelego-phpfox-router/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

phpfox-router
=============

[](#phpfox-router)

=====================================

### Add Simple Route

[](#add-simple-route)

```
return [
    'router.routes' => [
        'home'    => [
            'route'      => '/',
            'defaults' => [
                'controller' => Controller\IndexController::class,
                'action'     => 'index',
            ],
        ],
        'members'   => [
            'route'      => 'members',
            'defaults' => [
                'controller' => AdminIndexController::class,
                'action'     => 'index',
            ],

        ],
    ],
];
```

Implicit options using `(/)`

```
return [
    'router.routes' => [
        'event_action'    => [
            'route'      => '/blogs/browse(/)',
            'defaults' => [
                'controller' =>  Controller\IndexController::class,
                'action'     => 'browse',
                'sort'       => 'recents'
            ],
        ],
    ],
];
```

Add condition to pattern `wheres`

```
return [
    'router.routes' => [
        'blog_action'    => [
            'route'      => '/blog//',
            'wheres'=>[
                'id'=>'\d+',
                'action'=>(edit|delete|view|upgrade|settings)
            ],
            'defaults' => [
                'controller' => Controller\IndexController::class,
                'action'     => 'index',
            ],
        ],
    ],
];
```

### Create Filter

[](#create-filter)

```
return [
    'router.filters' => [
        '@profile' => [null, ProfileNameFilter::class],
    ],
];
```

Apply filter to route

**'filter' =&gt; '@profile',**

```
return[
    'router.routes'         => [
        'profile/members' => [
            'route'    => '/{members}',
            'filter'   => '@profile',
            'defaults' => [
                'controller' => Controller\IndexController::class,
                'action'     => 'index',
            ],
        ],
    ],
];
```

You can add single one or multiple filter using \[filter1, filter2,...\], All filters will be traversed, The result will be true if the route passed all filter rules.

### Translate

[](#translate)

Translated phrase must be apply before RoutingManager constructing.

> 1. Edit phrases in "$root/config/local.config.php"
> 2. Translated phrases must not contain blank or special characters.
> 3. Be careful that translated phrases does not duplicated another phrase in the same context.

```
return [
    'router.phrases' => [
        '{admincp}' => 'admincp',
        '{blog}'=>'bài-viết',
        '{members}=>'thành-viên',
    ],
];
```

### Get URL

[](#get-url)

```
service('routing')->getUrl('profile/members', ['name'=>'codelego']);
// origin      "codelego/members"
// translated  "codelego/thành-viên" if {member} is configured to "thành-viên".
```

### Environment Params

[](#environment-params)

Example:

```
posts/en/policy
posts/vi/policy
```

With "en" or "vi" will be added by the current member locale, But you don't want to put $locale to every getUrl() invoked. The simplest way is using EnvironmentParams.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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://avatars.githubusercontent.com/u/171187?v=4)[CodeLego](/maintainers/codelego)[@codelego](https://github.com/codelego)

---

Top Contributors

[![codelego](https://avatars.githubusercontent.com/u/171187?v=4)](https://github.com/codelego "codelego (20 commits)")[![jacky0482](https://avatars.githubusercontent.com/u/57336869?v=4)](https://github.com/jacky0482 "jacky0482 (4 commits)")

### Embed Badge

![Health badge](/badges/codelego-phpfox-router/health.svg)

```
[![Health](https://phpackages.com/badges/codelego-phpfox-router/health.svg)](https://phpackages.com/packages/codelego-phpfox-router)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k104.3M844](/packages/laravel-socialite)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M289](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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