Download the PHP package ocallit/sqler without Composer
On this page you can find all versions of the php package ocallit/sqler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ocallit/sqler
More information about ocallit/sqler
Files in ocallit/sqler
Package sqler
Short Description A php sql builder, helpers and mysqli wrapper
License MIT
Informations about the package sqler
Sqler - PHP Database Access Library
- A php sql builder, database & query metadata, auditor, helpers and mysqli wrapper.
- A powerful, feature-rich PHP database access layer built on MySQLi, providing intelligent query building, comprehensive error handling, database metadata introspection, and complete audit trail functionality.
Key Features
- 🔄 Intelligent Error Recovery - Automatic retry on deadlocks, timeouts, and connection issues
- 🛡️ Robust Error Handling - Comprehensive exception handling with specific error type detection
- 📊 Multiple Result Formats - Get data in the shape you need: single values, rows, arrays, key-value pairs
- 🔍 Database Introspection - Complete metadata access for tables, columns, relationships
- 📝 Audit Trail System - Full change tracking with diff analysis and user attribution
- ⚡ Smart Query Building - Parameterized queries with MySQL function recognition
- 🔒 Transaction Management - Nested transaction support with automatic cleanup
- 📋 Query & Error Logging - Comprehensive logging for debugging and monitoring
AI Assistant Documentation
For AI assistants and comprehensive API reference: See Sqler_AI_DOCUMENTATION.md - This contains detailed method signatures, return types, usage patterns, and examples specifically formatted for AI assistance.
Installation & Quick Start
Requirements
- PHP 8.2+
- MySQLi extension
- MySQL 5.7+ / MariaDB 10.2+
Installation via Composer
Basic Usage
Core Components
SqlExecutor - Database Query Engine
The heart of the library, providing multiple ways to execute and retrieve data:
Error Handling with Smart Recovery:
QueryBuilder - Safe Query Construction
Build parameterized queries with automatic escaping and MySQL function recognition:
DatabaseMetadata - Schema Introspection
Get complete information about your database structure:
Historian - Complete Audit Trail
Track all changes with automatic diff analysis:
Advanced Features
Transaction Management
Error Recovery & Logging
Configuration Options
SqlExecutor Configuration
QueryBuilder Options
Best Practices
- Always use parameterized queries - The library handles this automatically
- Initialize DatabaseMetadata once at application startup
- Use appropriate result methods based on expected data shape
- Implement proper error handling with specific error type checking
- Close connections properly in finally blocks
- Use transactions for multi-query operations
- Leverage audit trails for compliance and debugging
Error Handling Reference
The library provides specific error detection methods:
is_last_error_table_not_found()- Missing tablesis_last_error_duplicate_key()- Unique constraint violationsis_last_error_foreign_key_violation()- Invalid foreign key referencesis_last_error_child_records_exist()- Cannot delete parent with childrenis_last_error_column_not_found()- Invalid column names
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please ensure:
- PHP 8.2+ compatibility
- Comprehensive error handling
- Unit tests for new features
- Documentation updates
Support
For issues, feature requests, or questions, please use the GitHub issue tracker.
All versions of sqler with dependencies
ext-mysqli Version *