DBease is a lightweight and easy-to-use PHP database abstraction library designed for MySQL, using the power of PDO. It simplifies common database operations and offers a flexible query builder, making it a valuable tool for developers who want to interact with databases efficiently.
Features
- Simplified CRUD Operations: Perform Create, Read, Update, and Delete (CRUD) operations with ease.
- Flexible Query Builder: Build complex queries with a fluent interface.
- Custom SQL Execution: Execute raw SQL queries when needed.
- Exception Handling: Robust error handling with detailed exceptions.
- Query Logging: Keep track of executed queries for debugging.
- Table and Column Existence Checks: Verify the existence of tables and columns.
- Composer-Friendly: Easily install and manage using Composer.
Installation
DBease can be installed via Composer:
composer require erikthiart/dbease
Getting Started
Initialize DBease
use DBeaseDatabase; // Initialize the database connection $db = new Database();
Insert Data
Update Data
Query Data
Execute Raw SQL
‘Electronics’];
$results = $db->raw($sql, $params);” dir=”auto”>
$results = $db->raw($sql, $params);” dir=”auto”>
// Execute a custom SQL query $sql = "SELECT * FROM products WHERE category = :category"; $params = ['category' => 'Electronics']; $results = $db->raw($sql, $params);
Query Builder
Show comment