ocolin/easydb 问题修复 & 功能扩展

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

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

ocolin/easydb

最新稳定版本:2.1

Composer 安装命令:

composer require ocolin/easydb

包简介

Basic ENV based database handler meant for simple use light weight cases

README 文档

README

About

This is a very simple library with a lot of default configuration. It was built for custom purposes. Because of the many hard-set configuration settings it is not ideal for general use.Here are some of those:

  • Uses MySQL
  • Uses PDO
  • Does not stringify values
  • Runs in exception mode

Meant as a customer fast/lightweight handler for throwing into scripts that don't need customization

Environment

Handler does have a function for directly inputting DB configuration. However it was made for reading DB credentials from environment variables.

By default, it will look for existing environment variables. But, if local is set to true, it will load environment variables from a local .env file. This is useful in cases where this library is cloned instead of used as a composer plugin. If you have many projects including this library you can maintain a single set of DB credentials.

Example: envDbHandler

$db = DB::envDbHandler( prefix: 'MYDATA' );

In this example environment variables will need to be named as:

  • MYDATA_DB_HOST
  • MYDATA_DB_NAME
  • MYDATA_DB_USER
  • MYDATA_DB_PASS

Example: localHandler

$db = DB::localHandler( prefix: 'MYDATA' );

In this example environment variables will need to be named as:

  • MYDATA_DB_NAME
  • MYDATA_DB_USER
  • MYDATA_DB_PASS

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-01