| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Complete collection of 55 runnable examples demonstrating PDOdb features across all 6 database dialects (MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, Oracle).
# SQLite is pre-configured and ready to use
php 01-basic/02-simple-crud.php# Edit config.mysql.php with your credentials
# File already exists in examples/ directory
nano config.mysql.php
# Run with MySQL
PDODB_DRIVER=mysql php 01-basic/02-simple-crud.php# Edit config.mariadb.php with your credentials
# File already exists in examples/ directory
nano config.mariadb.php
# Run with MariaDB
PDODB_DRIVER=mariadb php 01-basic/02-simple-crud.php# Edit config.pgsql.php with your credentials
# File already exists in examples/ directory
nano config.pgsql.php
# Run with PostgreSQL
PDODB_DRIVER=pgsql php 01-basic/02-simple-crud.php# Edit config.sqlsrv.php with your credentials
# File already exists in examples/ directory
nano config.sqlsrv.php
# Run with MSSQL
PDODB_DRIVER=sqlsrv php 01-basic/02-simple-crud.php# Edit config.oracle.php with your credentials
# File already exists in examples/ directory
nano config.oracle.php
# Run with Oracle
PDODB_DRIVER=oci php 01-basic/02-simple-crud.php./scripts/test-examples.shThis script automatically:
PDOdb examples use separate config files per database:
| File | Database | Status |
|---|---|---|
| config.sqlite.php | SQLite | ✅ Included, ready to use (:memory:) |
| config.mysql.php | MySQL | ✅ Included, update credentials |
| config.mariadb.php | MariaDB | ✅ Included, update credentials |
| config.pgsql.php | PostgreSQL | ✅ Included, update credentials |
| config.sqlsrv.php | Microsoft SQL Server | ✅ Included, update credentials |
| config.oracle.php | Oracle | ✅ Included, update credentials |
Environment variable PDODB_DRIVER controls which config to use:
No environment variable? Defaults to SQLite with :memory: database.
Essential operations to get started.
Common patterns and operations.
Complex operations and patterns.
Working with JSON data across all databases.
SQL helper functions for common operations.
Data loading, batch processing, seeds, and export operations.
Performance optimization: caching, profiling, and EXPLAIN analysis.
Architectural patterns: read/write splitting and sharding.
Object-based database operations with relationships and scopes.
Extending PdoDb: macros, plugins, and events.
Database schema management: DDL and migrations.
Reliability features: exception handling and connection retry.
Complete applications and patterns.
Various examples and demonstrations.
Examples demonstrating how to use optional dependencies with PDOdb.
See: Optional Dependencies README for installation and usage instructions.
All examples use the QueryBuilder fluent API - no raw SQL except for table creation:
// ✅ Good - uses QueryBuilder
$users = $db->find()
->from('users')
->where('age', 18, '>')
->orderBy('name')
->get();
// ❌ Avoid - raw SQL (except for DDL)
$users = $db->rawQuery('SELECT * FROM users WHERE age > 18 ORDER BY name');Examples automatically adapt to your database:
For detailed documentation on each topic, see:
Each example category has corresponding documentation:
If you encounter issues:
php -m | grep pdo_mysql
php -m | grep pdo_pgsql
php -m | grep pdo_sqlite
php -m | grep ociPDODB_DRIVER=mysql php examples/01-basic/02-simple-crud.php| Back | FazBrowse Home | New Git URL |