silassare/gobl
Composer 安装命令:
composer require silassare/gobl
包简介
Gobl allows you to use a Database Abstraction Layer (DBAL) and Object-Relational Mapping (ORM) to query your database with PHP.
README 文档
README
A PHP 8.1+ Database Abstraction Layer (DBAL) and ORM with code generation for MySQL/MariaDB, PostgreSQL, and SQLite.
Features
- Schema-first: define tables, columns, constraints, and relations in PHP arrays or a fluent builder
- Typed query builder:
QBSelect,QBInsert,QBUpdate,QBDeletewith safe PDO value binding - Code generation: strongly-typed PHP entity, controller, query, and CRUD classes per table
- Event-driven CRUD: before/after hooks for every write operation via
*Crudclasses - Multi-driver: one schema, three databases - MySQL/MariaDB, PostgreSQL, SQLite
- Migration engine:
Diffbetween schema versions +MigrationRunner
Requirements
- PHP >= 8.1
- PDO extension with at least one of:
pdo_mysql,pdo_pgsql,pdo_sqlite
Installation
composer require silassare/gobl
Documentation
Full documentation on GitHub:
Quick example
use Gobl\DBAL\Drivers\MySQL\MySQL; use Gobl\DBAL\DbConfig; $db = MySQL::newInstanceOf(new DbConfig([ 'db_host' => '127.0.0.1', 'db_name' => 'myapp', 'db_user' => 'root', 'db_pass' => 'secret', ])); $db->ns('App\Db')->schema([ 'users' => [ 'singular_name' => 'user', 'plural_name' => 'users', 'column_prefix' => 'user', 'constraints' => [ ['type' => 'primary_key', 'columns' => ['id']], ], 'columns' => [ 'id' => ['type' => 'bigint', 'auto_increment' => true, 'unsigned' => true], 'name' => ['type' => 'string', 'max' => 60], ], ], ])->enableORM('/path/to/output');
License
MIT
统计信息
- 总下载量: 533
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-17