Skip to content

Bob ORM v3.0.0Complete Database Toolkit for PHP

Full-featured ORM with models, relationships, migrations, and schema builder - Your complete database solution for PHP

Bob Query Builder

Quick Start โ€‹

php
use Bob\Database\Connection;

// Configure your connection
$connection = new Connection([
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'myapp',
    'username' => 'root',
    'password' => 'password',
]);

// Start building queries
$users = $connection->table('users')
    ->where('status', 'active')
    ->orderBy('created_at', 'desc')
    ->limit(10)
    ->get();

Model Example โ€‹

php
use Bob\Database\Model;

class Post extends Model
{
    protected string $table = 'posts';
    
    public static function findBySlug(string $slug): ?self
    {
        $result = static::query()
            ->where('slug', $slug)
            ->first();
        
        return $result ? static::hydrate($result) : null;
    }
}

// Use your custom methods
$post = Post::findBySlug('hello-world');

Why Bob? โ€‹

Bob Query Builder was born from the need for a powerful, standalone query builder that could enhance Quantum ORM's capabilities. But it quickly evolved into something more - a fully independent, framework-agnostic solution that brings Laravel's elegant query building to any PHP project.

Perfect For: โ€‹

  • WordPress Plugins - Replace slow wpdb queries with optimized prepared statements
  • Microservices - Lightweight database layer without framework overhead
  • Legacy Modernization - Gradually modernize database code without full rewrites
  • Performance Critical Apps - Connection pooling, caching, and profiling built-in
  • Learning Projects - Clean, well-documented code that's easy to understand

Installation โ€‹

Install Bob via Composer:

bash
composer require marwen-brini/bob-the-builder

That's it! No complex configuration or bootstrapping required.

Community โ€‹

Join our growing community of developers using Bob Query Builder:

Released under the MIT License.