Download the PHP package lzpeng/php-user-auth without Composer

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

php-user-auth

用户认证核心库,目标是抽象并统一认证API, 各个php框架能在其之上快速实现一个稳定的用户认证库。

概念

用户身份对象

用于表示用户身份

用户身份对象提供器

对于不同系统,用户身份信息来源可能都不一样,可能来源于数据库、配置文件、甚至第三方系统等。

认证器

核心; 抽象用户认证API

认证管理器

组装内部组件,创建认证器

访问控制器

提供一个简单的基于资源的权限访问控制功能

权限资源提供器

权限资源可能来源于数据库、配置文件等,所以抽象出来

事件管理器

为认证器、访问控制器提供事件处理能力

基本使用方式

// 配置 $config = [ 'default' => 'test', 'authenticators' => [ 'test' => [ 'driver' => 'session', 'params' => [ 'session_key' => 'UserIdentity', ], 'provider' => [ 'driver' => 'model', 'params' => [ 'model' => \app\common\model\User::class, ] ], 'events' => [ 'login_before' => [] ] ], 'test2' => [ 'driver' => 'token', 'params' => [ 'token_key' => 'user-token', ], 'provider' => [ 'driver' => 'model', 'params' => [ 'model' => \app\common\model\User::class, ] ], 'events' => [ 'login_before' => [] ] ] ] ];

$authManager = new AuthManager($config);

// 注册认证器 $authManager->registerAuthenticatorCreator('session', function($config) { // 认证器需要实现AuthenticatorInterface // 如果需要事件处理功能,需要实现EventableInterface接口 // 如果需要访问控制功能,需要实现AccessableInterface接口 // 或直接继承AbstractAuthenticator return new SessionAuthenticator($config['session_key']); }); // 注册用户提供器 $authManager->registerUserProviderCreator('model', function($config) { // 需要实现UserProviderinterface接口 return new ModelUserProvider($config['model']); });

// 创建默认认证器 $authenticator = $authManager->create(); // 创建指定的认证器 // $authenticator = $authManger->create('test2');

// 登录 $authenticator->login([ 'username' => 'xxx', 'password' => '****', ]);

// 是否已登录 $authenticator->isLogined();

// 获取用户 $user = $authenticator->user();

// 登出 $authenticator->logout();

扩展方式

扩展认证库


All versions of php-user-auth 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 lzpeng/php-user-auth contains the following files

Loading the files please wait ...