Skip to content

Latest commit

 

History

History

README.md

PDOdb Documentation

Complete documentation for the PDOdb library - a lightweight, framework-agnostic PHP database library providing a unified API across MySQL, PostgreSQL, and SQLite.

📖 Table of Contents

Getting Started

Core Concepts

Query Builder

JSON Operations

Advanced Features

Error Handling

Helper Functions

Best Practices

Reference

Cookbook

🚀 Quick Start

composer require tommyknocker/pdo-database-class
use tommyknocker\pdodb\PdoDb;
use tommyknocker\pdodb\helpers\Db;

$db = new PdoDb('mysql', [
    'host' => 'localhost',
    'username' => 'user',
    'password' => 'pass',
    'dbname' => 'mydb'
]);

$users = $db->find()
    ->from('users')
    ->where('age', 18, '>')
    ->andWhere(Db::jsonContains('tags', 'php'))
    ->orderBy('created_at', 'DESC')
    ->limit(10)
    ->get();

📚 Key Features

  • Fluent Query Builder - Intuitive chainable API
  • Cross-Database Support - Works with MySQL, PostgreSQL, SQLite
  • JSON Operations - Unified JSON API across all databases
  • Prepared Statements - Automatic parameter binding for security
  • Transactions - Full transaction support
  • Batch Processing - Handle large datasets efficiently
  • Connection Pooling - Manage multiple connections
  • Comprehensive Error Handling - Detailed exception hierarchy
  • Zero Dependencies - Lightweight and fast
  • Well Tested - Comprehensive test coverage
  • Type Safe - PHPStan level 8 compliant

💡 Navigation Tips

📖 Version

This documentation corresponds to PDOdb version 2.x.

🤝 Contributing

Found an issue or have a suggestion? Please open an issue on GitHub.

📄 License

This library is open source. See the LICENSE file for details.