Download the PHP package wuguofeng/webman-bouncer without Composer

On this page you can find all versions of the php package wuguofeng/webman-bouncer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package webman-bouncer

wuguofeng/webman-bouncer

Silber\Bouncer(RBAC 角色与能力)的 webman 插件。 将 bouncer 适配到 webman 的长驻进程模型:每个请求独立的 Bouncer 实例(独立的剪贴板与缓存), 避免进程级静态状态串号与权限缓存过期问题。

特性

安装

安装后插件配置自动拷贝到 config/plugin/wuguofeng/webman-bouncer/。

配置

编辑 config/plugin/wuguofeng/webman-bouncer/app.php:

缓存策略(cache)

值 说明
'request'(默认) 每请求独立内存缓存(ArrayStore),改动即刻生效,无需手动刷新。推荐日常使用
'none' 完全禁用缓存,每次校验都查库
store 名(如 'file'、'redis') 跨请求/跨进程持久缓存,复用你项目的 config/cache.php(webman/cache)里的 store

使用跨请求缓存前先安装并配置 webman/cache:

跨请求缓存适合权限数据量大、校验频繁、变更低频的场景(首次校验少查库、后续全部命中缓存)。 代价是权限改动不即时生效,变更后需要手动失效:

用户模型:

建表:

使用

中间件

config/plugin/wuguofeng/webman-bouncer/middleware.php 默认注册了 BouncerMiddleware(作用于所有请求), 保证请求处理器执行前已存在新鲜的 Bouncer 实例(trait 用法依赖它)。不需要可移除。

命令

命令 说明
php webman bouncer:install 创建 bouncer 四张表(abilities / roles / assigned_roles / permissions)。按 config/database.php 的默认连接驱动选择方言:MySQL 或 PostgreSQL。其他驱动(SQLite/SQL Server)请用 silber/bouncer 官方 migration 建表

数据库支持

运行时权限判定走 Eloquent(illuminate/database),因此只要配置的驱动正确,MySQL 与 PostgreSQL 均可正常使用 can()/allow()/assign()/forbid()。

PostgreSQL 的 config/database.php:

测试

前置:本地 MySQL(默认 127.0.0.1:3306,库 webman_bouncer_test,用户 bouncer / bouncer_pass), 可用环境变量覆盖:

环境变量 默认值
BOUNCER_TEST_DB_HOST 127.0.0.1
BOUNCER_TEST_DB_PORT 3306
BOUNCER_TEST_DB_NAME webman_bouncer_test
BOUNCER_TEST_DB_USER bouncer
BOUNCER_TEST_DB_PASS bouncer_pass
BOUNCER_TEST_CACHE request(request | none)

bootstrap 自动建库建表(每次运行先清空重建),并把数据库与插件配置替换为 tests/config/ 下的 fixture。测试用 support\Context 模拟请求边界(Context::destroy()),确保每请求实例、租户 scope、剪贴板等状态不在用例间串号。

工作原理

webman 是长驻进程,进程级静态状态会跨请求残留。本插件把 bouncer 的全部可变状态 (Clipboard、缓存、租户 Scope)放进每请求实例(存于 support\Context,协程安全), 启动时只做进程级一次性配置(Illuminate 容器单例、Eloquent、用户模型映射、morph map):

License

MIT


All versions of webman-bouncer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
workerman/webman-framework Version ^2.1
illuminate/container Version ^11.0 || ^12.0 || ^13.0
illuminate/database Version ^11.0 || ^12.0 || ^13.0
silber/bouncer Version ^1.0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wuguofeng/webman-bouncer contains the following files

Loading the files please wait ...