Obsidian ORM

Object-oriented, Lazy Building, UUID/Auto-increment compatible ORM.

Model Definition

app/Models/User.php
namespace App\Models;
use App\Core\Model;

class User extends Model
{
    protected string $table    = 'users';
    protected bool   $useUuid  = true;
    protected array  $fillable = ['name', 'email', 'password'];
}

CRUD + Lazy Building Examples

Obsidian ORM
$all    = User::all();
$user   = User::find(1);
$user   = User::where('email', 'nexus@core.id')->first();

// Lazy Building
$admins = User::where('role', 'admin')
    ->orderBy('created_at', 'desc')
    ->limit(10)
    ->get();

// Create
$user   = User::create([
    'name'     => 'Titan',
    'email'    => 'titan@ief.dev',
    'password' => password_hash('secret', PASSWORD_BCRYPT),
]);

// Update / Delete
User::where('id', 1)->update(['name' => 'Nexus']);
User::destroy(1);