Download the PHP package huang-yi/rbac-laravel without Composer

On this page you can find all versions of the php package huang-yi/rbac-laravel. 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 rbac-laravel

关于Rbac-Laravel

Rbac-Laravel是一个基于Laravel框架的RBAC拓展包,RBAC(Role-Based Access Control)是指基于角色的访问控制。该拓展包为Laravel框架提供了RBAC模型的实现,并且提供了诸多操作RBAC的便捷方法。

版本信息

Rbac Laravel PHP
1.0.x 5.3.* >=5.6.4

安装方法

使用composer来快速安装拓展包:

或者编辑项目根目录的composer.json文件,在require属性里面添加一项:

然后执行composer update

配置信息

首先往Laravel应用中注册ServiceProvider,打开文件config/app.php,在providers中添加一项:

然后发布拓展包的配置文件,使用如下命令:

这时候config/目录下会出现rbac.php文件,该配置文件中有两个配置选项:

第一个为connection属性,用于配置RBAC模块使用的数据库连接名。

第二个为user属性,用于配置Laravel应用中使用的用户模型。默认为App\User

上述配置文件中所配置的user模型类必须use HuangYi\Rbac\RbacTrait

数据迁移

执行以下命令创建拓展包必须依赖的数据库表:

使用方法

Permission

1、权限有三个属性:nameslugdescription

2、创建一个权限:HuangYi\Rbac\Managers\PermissionManager::create(array $attributes)

3、删除一个权限:HuangYi\Rbac\Managers\PermissionManager::delete($ID)

删除权限时会自动解绑已绑定的角色。

4、更新一个权限:HuangYi\Rbac\Managers\PermissionManager::update($ID, array $attributes)

5、查询一个权限:HuangYi\Rbac\Managers\PermissionManager::find($ID)

Role

1、角色有三个属性:nameslugdescription

2、创建一个角色:HuangYi\Rbac\Managers\RoleManager::create(array $attributes)

3、删除一个角色:HuangYi\Rbac\Managers\RoleManager::delete($ID)

删除角色时会自动解绑已绑定的用户和权限。

4、更新一个角色:HuangYi\Rbac\Managers\RoleManager::update($ID, array $attributes)

5、查询一个角色:HuangYi\Rbac\Managers\RoleManager::find($ID)

6、为角色绑定权限:HuangYi\Rbac\Managers\RoleManager::attachPermissions($permissionIDs)

7、为角色解绑权限:HuangYi\Rbac\Managers\RoleManager::detachPermissions($permissionIDs)

User

1、为用户绑定角色:HuangYi\Rbac\RbacTrait::attachRoles($roleIDs)

2、为用户解绑角色:HuangYi\Rbac\RbacTrait::detachRoles($roleIDs)

3、判断用户是否为某些角色,若需要判断多个角色请使用|间隔:HuangYi\Rbac\RbacTrait::hasRole($roles)

4、判断用户是否拥有某些权限,若需要判断多个权限请使用|间隔:HuangYi\Rbac\RbacTrait::hasPermission($permissions)

Middleware

Rbac-Laravel为开发人员提供了便利的Middleware,如果需要使用请将HuangYi\Rbac\RbacMiddleware注入到app/Http/Kernel.php中的路由中间件里:

配置好后即可在路由中使用:

在视图中使用

支持

Bugs和问题可提交至Github,或者请联系作者黄毅([email protected]

License

The Rbac-Laravel is open-sourced software licensed under the MIT license


All versions of rbac-laravel with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~5.0
illuminate/database Version ~5.0
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 huang-yi/rbac-laravel contains the following files

Loading the files please wait ....