DBease: A Lightweight Database Abstraction Library for MySQL
GitHub - ErikThiart/DBease: Simplify Database Interactions with DBEase
DBease: A Lightweight Database Abstraction Library for MySQL




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 DBease\Database;

// Initialize the database connection
$db = new Database();
Insert Data
$data = [
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'age' => 30,
];

// Insert into the 'users' table
$db->insert('users', $data);
Update Data
$updateData = ['status' => 'active'];

// Update records in the 'users' table where 'id' is 1
$db->update('users', $updateData, ['id' => 1]);
Query Data
// Find a single record from the 'users' table where 'id' is 1
$user = $db->find('users', ['id' => 1]);

// Find all active users
$activeUsers = $db->findAll('users', ['status' => 'active']);
Execute Raw SQL
// Execute a custom SQL query
$sql = "SELECT * FROM products WHERE category = :category";
$params = ['category' => 'Electronics'];
$results = $db->raw($sql, $params);
Query Builder
// Build complex queries
$results = $db
    ->select('name, price')
    ->limit(5)
    ->offset(10)
    ->fetchWithOffset('products', ['category' => 'Electronics']);
More Examples and Documentation
For more examples and detailed documentation, please refer to the DBease Wiki.
Contributing
Contributions are welcome! Please check the contribution guidelines for details.
License
DBease is open-source software licensed under the GNU General Public License.
Credits
DBease is developed and maintained by Erik Thiart.
Support
If you have questions or need assistance, feel free to open an issue.

