ocolin/bx-auth 问题修复 & 功能扩展

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

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

ocolin/bx-auth

最新稳定版本:1.1

Composer 安装命令:

composer require ocolin/bx-auth

包简介

Tool for authenticating using Billmax Auth database

README 文档

README

Database Authentication for Billmax

This package is not written with any public use in mind. It's an experiment for allowing external apps to login using the authentication in the Billmax billing software.

Instantiation

To connect to the database to verify authentication we need 4 pieces of information:

  • host - Name/IP of billmax server. Defaults to localhost.
  • name - Name of the database table. Defaults to billmax.
  • user - Username of database user.
  • pass - Password of database user.

Environment variables

The constructor arguments can be provided directly, or environment variables can be used instead:

  • BILLMAX_DB_HOST
  • BILLMAX_DB_NAME
  • BILLMAX_DB_USER
  • BILLMAX_DB_PASS

See ,env.example file.

Example - Constructor arguments

$auth = new \Ocolin\BxAuth\BxAuth(
    host: 'localhost',
    name: 'billmax',
    user: 'myusername',
    pass: 'mypassword'
);

Example - Environment variables

$_ENV['BILLMAX_DB_HOST'] = 'localhost';
$_ENV['BILLMAX_DB_NAME'] = 'billmax';
$_ENV['BILLMAX_DB_USER'] = 'myusername';
$_ENV['BILLMAX_DB_PASS'] = 'mypassword';

$auth = new \Ocolin\BxAuth\BxAuth();

Calls

Login

  • user - Username to log in as.
  • pass - Password to long in with.
  • session - Create a PHP session and add data to it.
$data = $auth->login(
    user: 'bobsuncle',
    pass: 'tiddlywinks',
    session: true
);

print_r( $_SESSION );

Array
(
    [LOGGED_IN] => 1
    [AUTH] => Ocolin\BxAuth\AuthData Object
        (
            [id] => 86
            [access] => 31
            [descr] => Bob Uncle
            [email] => bob@staff.test.com
            [user] => bobsuncle
            [fname] => Bob
            [lname] => Uncle
            [password] => $1$UV$hR/8uhVeBpD5Wzb0V7Dyz/
        )

)

By default the function returns an object with the user data in it. Setting seesion to true will add that data to $_SESSION['AUTH'].

Logout

This will log the user out, destroy the cookie, and wipe any session variables.

$auth->logout();

Check Login

Check to see if we are currently logged in. Return true or false.

$loggedin = $auth->check_Login();

var_dump( $loggedin );

bool(true)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固