ryodevz/simple-auth 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ryodevz/simple-auth

Composer 安装命令:

composer require ryodevz/simple-auth

包简介

Simple auth for your project.

README 文档

README

Latest Version Total Downloads

Requirements

  • PHP ^7.0

Features

  • Login (customization)

Installing simple-auth

The recommended way to install simple-auth is through Composer.

> composer require ryodevz/simple-auth

Configuration

config/simpleauth.php

<?php

return [
    'auth' => [
        'login' => [
            'base' => '/login.php',
            'fields' => [
                'btnLogin' => 'btn-login',
                'username' => 'username',
                'password' => 'password'
            ],
            'redirect' => [
                'success' => '/',
            ],
            'password_hash' => false
        ]
    ],
    'database' => [
        'host' => 'localhost',
        'username' => 'root',
        'password' => null,
        'database' => 'root',
        'users_table' => [
            'table' => 'users',
            'username' => 'email',
            'password' => 'password',
        ]
    ],
];

Start session

Auth::sessionStart()

Example usage

login.php

<?php

use Ryodevz\Auth;

include 'vendor/autoload.php';

Auth::sessionStart();
Auth::login();

if (Auth::user()->username) {
    return header('location: /');
}

?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
</head>

<body>

    <small style="color: red;"><?= Auth::error() ?></small>

    <form action="" method="post">
        <table>
            <tr>
                <td>Username</td>
                <td>:</td>
                <td><input type="text" name="username" placeholder="Username"></td>
            </tr>
            <tr>
                <td>Password</td>
                <td>:</td>
                <td><input type="password" name="password" placeholder="Password"></td>
            </tr>
        </table>
        <button type="submit" name="btn-login" value="true">Login</button>
    </form>

</body>

</html>

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固