Download the PHP package ttlphp/laravel-crbac without Composer

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

laravel5+、laravel6+、laravel7+、laravel8+、laravel9+ 权限管理系统

该模板依赖于laravel,包含基本权限管理所需要功能改模块,安装后简单配置即可使用,并且提供View,比较适合项目初期。

目录

Installation

注意 安装前确定laravel已经安装就绪

使用composer安装

使用GIT安装

使用GIT命令下载程序包。

修改自动加载配置

打开 vendor/composer/autoload_psr4.php 添加命令空间加载目录:

打开 vendor/composer/autoload_static.php 添加命令空间加载目录,此文件有多处需要添加,暂不示例

打开 vendor/composer/autoload_files.php 添加助手函数加载:

Configuration

需要在laravel中启用应用,需要作几个配置修改。

打开配置文件 config/app.php 添加应用服务到容器:

打开配置文件 config/auth.php 添加授权模型:

配置数据,运行安装命令(注意多次运行此命令会覆盖重写自带的表和数据)

打开浏览器验证效果

lang

项目中提供了中文基础文件,方便在验证分页等信息是自由切换,项目全部以中文提示为语言基础。 安装中文需要运行命令

命令会复制预定中文字典复制到语言配置目录中。

打开配置文件 config/app.php 修改默认语言

table

当使用手动安装或初始化权限数据表结构时,在这里提供了 artisan 命令,方便手动重置表结构及基础数据。

表结构如下

表名 说明
power_role_admin 管理员表
power_item 权限项表,记录所有权限项基础数据
power_item_group 权限项组表,用于权限项分组,当前只设计一级。
power_menu 菜单表,记录所有菜单基础数据,并且可以关联到权限项
power_menu_group 菜单组表,用于区分不同菜单组的菜单结构。
power_menu_level 菜单层级表,记录菜单的组成层级结构。
power_role 角色表。
power_role_admin 角色与管理员关联表
power_role_item 角色与权限项关联表
power_route 路由记录表,方便添加权限项。

use

要使用Crbac功能必需配置授权模型且必需继承预定模型(参考下面介绍),如果没有配置则整个项目会跳过路由配置和权限处理初始化,即无法正常使用权限功能。

权限校验

Crbac权限处理会自动绑定在使用了auth中间件的路由上,即新增路由只需要追加auth中间件即可自动进行权限核验。

权限管理

权限使用,管理员 —> 角色(多个) —> 权限项(多个)

每个管理员可以绑定多个角色,每个角色可以绑定多个权限项,之间允许交叉和重复

菜单使用,管理员 —> 菜单组 —> 权限项(多个)

每个管理员绑定一套菜单组,方便各组管理员展示完全不同的菜单结构

定制权限

预定权限只适用预定全部功能,额外增加的权限即需要定制权限,路由和菜单权限预定功能即可满足,可自行配置增加权限组、权限项、菜单组、菜单项、角色等操作。

如果需要页面内或逻辑权限也可以定制添加,并需要在业务代码中增加权限判断,可以使用函数:

更多协助函数可参考文件:./vendor/ttlphp/laravel-crbac/src/helpers.php

登录和退出

Crbac会在路由加载完成后判断是否存在别名为 login 和 logout 两个路由,如果没有则会自动增加预定好的两个登录和退出路由,保证权限基本正常使用。如果需要截取预定登录和退出路由只需要手动添加两个别名路由即可。

attention

view中的JS及CSS未经过严格的兼容测试,一般支持CSS3的浏览器均无异常。

权限管理样式并不能保证通用已经存在的项目,如果需要改变样式可以将项目中的视图文件进行重写并放到自己视图处,此时预定视图会被劫持。


All versions of laravel-crbac with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
laravel/framework 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 ttlphp/laravel-crbac contains the following files

Loading the files please wait ....