simsoft/adodb-orm
Composer 安装命令:
composer require simsoft/adodb-orm
包简介
ORM wrapper for ADOdb PHP
README 文档
README
This is an ORM wrapper for ADOdb (https://adodb.org/)
Requirements
- PHP >= 8
Installation
- Install package using composer
$ composer require simsoft/adodb-orm
Getting Started
require_once "vendor/autoload.php"; require_once "vendor/adodb/adodb-php/adodb-active-recordx.inc.php"; use Simsoft\ADOdb\DB; use Simsoft\ADOdb\Query; $config = [ 'mysql' => [ 'driver' => 'mysqli', 'host' => '127.0.0.1', 'user' => 'username', 'pass' => 'password', 'schema' => 'db_example', ], /* Sample config 'connection_name' => [ 'driver' => 'mysqli', 'host' => '127.0.0.1', 'user' => 'username', 'pass' => 'password', 'schema' => 'database_name', 'debug' => true, 'execute' => [ // run once when the connection is successful. "SET @@session.time_zone='+00:00'", ], ],*/ ]; // Initiate DB config DB::init($config); $result = DB::use('mysql')->execute('SELECT * FROM table1 WHERE attr1 = ? AND attr2 = ?', ['value1', 'value2']); while ($row = $result->fetchRow()) { print_r($row); } // Insert new record $success = DB::use('mysql')->insert('table', ['attr1' => 'value1', 'attr2' => 'value2']); // Update an record. $success = DB::use('mysql')->update('table', ['attr1' => 'value1', 'attr2' => 'value2'], 'id=2'); $success = DB::use('mysql')->update('table', ['attr1' => 'value1', 'attr2' => 'value2'], Query::where('id', 2)); // Return result in array $result = DB::use('mysql')->getArray('SELECT * FROM user WHERE name LIKE ?', ['%john%']); // Enable debug mode $result = DB::use('mysql')->debug()->getArray('SELECT * FROM user WHERE name LIKE ?', ['%john%']);
Basic Usage
Query Builder
require_once "vendor/autoload.php"; require_once "vendor/adodb/adodb-php/adodb-active-recordx.inc.php"; use Simsoft\ADOdb\DB; use Simsoft\ADOdb\Query; $config = [ 'mysql' => [ 'driver' => 'mysqli', 'host' => '127.0.0.1', 'user' => 'username', 'pass' => 'password', 'schema' => 'db_example', ], ]; DB::init($config); $result = Query::db('mysql')->from('table')->where('attr1', 'value1')->where('attr2', 'value2')->execute(); while ($row = $result->fetchRow()) { print_r($row); }
Active Record
namespace Model; use Simsoft\ADOdb\ActiveRecord; /** * Class User */ class User extends ActiveRecord { /** @var string Connection name */ public $_dbat = 'mysql'; /** @var string table name */ public $_table = 'user'; }
require_once "vendor/autoload.php"; require_once "vendor/adodb/adodb-php/adodb-active-recordx.inc.php"; use Simsoft\ADOdb\DB; use Model\User; $config = [ 'mysql' => [ 'driver' => 'mysqli', 'host' => '127.0.0.1', 'user' => 'username', 'pass' => 'password', 'schema' => 'db_example', ], ]; DB::init($config); $users = User::query()->where('age', '>', 20)->where('gender', 'male')->findAll(); foreach ($users as $user) { echo $user->first_name; echo $user->last_name; }
Documentations
License
The WeCanTrack PHP API is licensed under the MIT License. See the LICENSE file for details
simsoft/adodb-orm 适用场景与选型建议
simsoft/adodb-orm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 356 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 11 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「php」 「active-record」 「adodb」 「sencillez」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 simsoft/adodb-orm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 simsoft/adodb-orm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 simsoft/adodb-orm 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Inspired by and put together the awesomeness of many yii extensions that aim to improve saving of related records. Comes with 100% test coverage and well structured and clean code so it can savely be used in enterprise production enviroment.
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Active record implementation
PeskyORM - annoying ORM that contains tons of exceptions and throws them when anything goes wrong
MongoDB extension for the Yii framework
统计信息
- 总下载量: 356
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-21