shusaura85 / mythdb
Simple database abstraction layer for PHP
1.0.0
2024-10-03 14:57 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^9.5
README
By Shu Saura
MythDB is a simple database abstraction layer for PHP providing a consistent interface for multiple database drivers.
Supported databases
- mySQL and MariaDB
- PostreSQL
- SQLite3
Installation
-
Using Composer
composer require shusaura85/mythdb
-
Manually
require '/path/to/src/autoload.php'
Usage
require 'vendor/autoload.php'; // or '/path/to/src/autoload.php' $db_driver = 'mysqli'; // available drivers: mysqli, pgsql, sqlite3 $db_persistent = false; // set to true to use a persistent connection $db_utf8names = 'UTF8'; // if set, automatically calls query "SET NAMES <value>". not supported in sqlite $db = new \MythDB\Database($db_driver, 'host', 'username', 'password', 'database', $db_persistent, $db_utf8names);
Requirements
MythDB requires at least PHP 8.1
to work. MythDB only depends on the internal PHP modules for database connection (mysqli / postresql / sqlite3).
Licence
MythDB is published under the MIT Licence, see LICENSE
file for details.