sibertec/data
Composer 安装命令:
composer require sibertec/data
包简介
Sibertec.Data is a small, easy to use PHP library that manages connections to MySQL databases, and also can act as an Object Relational Mapper.
关键字:
README 文档
README
Sibertec.Data is a small, easy to use PHP library that manages connections to MySQL or SQLite databases, and also can act as an Object Relational Mapper.
How to Use
The data settings are read from a YAML file.
You can either pass the path to the YAML file to the constructor, or set the path in a global variable, $sibertec_settings_file;
The settings can be in a file with other settings, or in a YAML file by themselves.
For MySQL data, use the following example.
database:
driver: MySQL
server: localhost
database: your_database
user: your_username
pwd: your_password
For SQLite data, use the following example. Only the local file system is supported.
database:
driver: SQLite
server: local_file_system
database: /path/to/your/data_file.sqlite
user: not-used
pwd: not-used
How to use
You can pass the full path to the SQL fiole to load, or put your SQL files in a directory, and set the location with either
define('SQL_DIR', '/path/to/sql'); or $sibertec_sql_dir = '/path/to/sql';.
Load an object from the database using a SQL file.
$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'
$sibertec_sql_dir = '/var/www/sites/your-site/sql';
$db = AppData::MainDatabase();
$obj = SqlHelper::SqlFileToScalarObject('get_one.sql', $db);
Execute a SQL statement;
$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'
$db = AppData::MainDatabase();
$db->run_sql("delete from your_table where id < 101");
Execute a SQL statement, returning an integer;
$sibertec_settings_file = '/var/www/sites/your-site/settings.yaml'
$db = AppData::MainDatabase();
$val = $db->execute_scalar_int("select count(*) from your_table");
sibertec/data 适用场景与选型建议
sibertec/data 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.57k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 06 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「mysql」 「data access」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sibertec/data 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sibertec/data 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sibertec/data 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Dibi is Database Abstraction Library for PHP
Store your language lines in the database, yaml or other sources
Adds the EDTF data type to Wikibase
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A simple library that allows transform any kind of data to native php data or whatever
统计信息
- 总下载量: 6.57k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-06-06