PHPackages                             thefunpower/url\_acl - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. thefunpower/url\_acl

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

thefunpower/url\_acl
====================

基于URL的权限

v2.0.1(2y ago)013Apache-2.0PHP

Since Nov 29Pushed 2y agoCompare

[ Source](https://github.com/thefunpower/url_acl)[ Packagist](https://packagist.org/packages/thefunpower/url_acl)[ RSS](/packages/thefunpower-url-acl/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)DependenciesVersions (3)Used By (0)

基于URL的权限管理
==========

[](#基于url的权限管理)

### 添加权限

[](#添加权限)

```
url_acl_add('产品列表','/index.php/goods');
url_acl_add('产品','/index.php/goods/add');

```

### 取权限信息

[](#取权限信息)

```
print_r(get_url_acl());

```

### 对角色赋予权限

[](#对角色赋予权限)

```
url_acl_add_auth("管理员",'产品');
url_acl_add_auth("管理员",'产品列表');

```

### 查看角色可以访问的URL

[](#查看角色可以访问的url)

```
$res = get_url_acl_auth_urls("管理员");
print_r($res);

```

### 检测是否有权限

[](#检测是否有权限)

```
print_r(url_acl("管理员"));

```

### 在平台软件中使用

[](#在平台软件中使用)

```

global $acl_config;

$acl_config['员工授权'] = [
	'管理'=>'/sys/acl/*',
	'查寻'=>'/sys/acl/view',
];

$acl_config['费用'] = [
	'管理'=>'/sys/expense/*',
	'查寻'=>'employee/user/*',
];

foreach($acl_config as $k=>$v){
	foreach($v as $k1=>$v1){
		url_acl_add($k.$k1,$v1);
		url_acl_add_auth($k,$k.$k1);
	}
}

```

判断权限

```
add_action("acl.check", function (&$data) {
    $route = IRoute::get_action();
    $package = $route['package'];
    $module = $route['module'];
    $controller = $route['controller'];
    $action = $route['action'];
    $str = $module . '/' . $controller . '/' . $action;
    $str1 = $module . '/' . $controller . '/*';
    $list = $data['list'];
    foreach($list as $v) {
        $a = substr($v, 0, 1);
        if($a == '/') {
            $v = substr($v, 1);
        }
        if($v == $str || $v == $str1) {
            $data['res'] = true;
            return;
        }
    }
    $data['res'] = false;
});
pr(url_acl(["员工授权",'费用']));

```

### 安装

[](#安装)

在composer.json中添加

```
"thefunpower/url_acl": "dev-main"

```

### 开源协议

[](#开源协议)

[Apache License 2.0](LICENSE)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~54 days

Total

2

Last Release

893d ago

Major Versions

v1.0.1 → v2.0.12024-01-22

### Community

Maintainers

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

---

Top Contributors

[![sunkangchina](https://avatars.githubusercontent.com/u/66815206?v=4)](https://github.com/sunkangchina "sunkangchina (1 commits)")

---

Tags

php

### Embed Badge

![Health badge](/badges/thefunpower-url-acl/health.svg)

```
[![Health](https://phpackages.com/badges/thefunpower-url-acl/health.svg)](https://phpackages.com/packages/thefunpower-url-acl)
```

###  Alternatives

[dusterio/lumen-passport

Making Laravel Passport work with Lumen

6601.3M9](/packages/dusterio-lumen-passport)

PHPackages © 2026

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