Download the PHP package qimao/authentication without Composer

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

使用指南

本包是基于yii2框架实现的一套简单权限管理工具

数据结构

安装时需要在数据库中生成以上数据表

qma_auth:存储具体的权限信息,分为接口权限和页面权限

qma_auth_role:存储角色信息

qma_role_auth_relation:存储角色与权限的绑定关系

qma_user_auth_role:存储用户与角色的绑定关系

目录

common:该目录存放一下公共常量、函数和工具类

controllers:该目录为控制器目录,AuthController.php和AuthRoleController.php实现权限数据的增删改查接口,BaseController.php控制器实现后端接口的权限校验,SiteController.php控制器实现页面路由的权限校验

logic:实现具体应用逻辑的类

messages:输出信息

models:数据模型

traits:实现具体校验逻辑的方法

安装步骤

  1. 项目路径下执行composer命令

  2. 配置db信息,执行sql语句,生成相关数据结构

  3. 将vendor/qimao/authentication/messages/zh-CN/authentication文件夹复制到项目路径/messages/zh-CN/下

  4. 修改配置文件,增加配置

    在项目合适的位置增加路径配置,如bootstrap.php或者入口php文件

  5. 将vendor/qimao/authentication/controllers下的文件复制到项目应用中的controllers路径下,并修改所有文件的命名空间为项目控制器的命名空间

  6. 修改BaseController.php实现接口权限控制,项目其他接口需继承该类,也可以修改该类的继承类实现前置校验。刚安装时实例代码进行了注释,目的是在使用接口生成权限数据前不进行权限校验,因为此时数据表中尚无权限数据。使用时需要根据实际项目情况修改实例代码,实现权限管理。

  7. 修改SiteController.php实现页面路由控制,为达到这一目的,需要在配置文件中将相关url定向到该控制器

  8. 配置完以上步骤,先将BaseController.php和SiteController.php控制器中的权限校验代码关闭,然后调用接口生成权限数据,之后再开启权限校验。

  9. 配置权限,权限分为两种:页面权限和接口权限,页面权限指前端页面地址权限,接口权限指数据访问接口地址权限,均可实现树级管理。新增权限时,url必须以'/'开头,顶级权限的parent_id为0,其他权限均为顶级权限子权限。权限校验时,会先校验子权限是否满足,不满足时会校验该权限的所有父级权限,只要有一个符合,则认为该用户具有访问权限。实际应用中,通常将控制器id设为父权限,如'/auth'为权限控制器顶级权限,'/auth/add-auth'为权限控制器中新增权限的接口,则该权限即为权限控制器子权限。当用户仅配置父权限时,会认为该用户同时具有该父权限下所有子权限的访问权限,即当用户配置了'/auth',则自动拥有'/auth/add-auth'的权限,可以不再重复配置。

All versions of authentication with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 qimao/authentication contains the following files

Loading the files please wait ....