forjix/database
最新稳定版本:0.1.0
Composer 安装命令:
composer require forjix/database
包简介
Forjix Framework database layer
README 文档
README
Database abstraction layer for the Forjix framework with query builder, schema builder, and migrations.
Installation
composer require forjix/database
Requirements
- PHP 8.2+
- PDO extension
Configuration
use Forjix\Database\DatabaseManager; $manager = new DatabaseManager([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'myapp', 'username' => 'root', 'password' => '', 'charset' => 'utf8mb4', ]);
Query Builder
// Select $users = $db->table('users') ->where('active', true) ->orderBy('name') ->get(); // Insert $db->table('users')->insert([ 'name' => 'John', 'email' => 'john@example.com', ]); // Update $db->table('users') ->where('id', 1) ->update(['name' => 'Jane']); // Delete $db->table('users') ->where('id', 1) ->delete();
Schema Builder
use Forjix\Database\Schema\Schema; Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->timestamps(); });
Migrations
use Forjix\Database\Migration\Migration; class CreateUsersTable extends Migration { public function up(): void { Schema::create('users', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('users'); } }
License
GPL-3.0
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2026-01-05