mirarus / db
Mirarus Database Library
0.12
2024-06-22 16:38 UTC
Requires
- php: ^7.3 || ^8.0
- ext-pdo: *
README
Mirarus Database Library
Installation
Install using composer:
composer require mirarus/db
Example
Install using composer:
<?php require 'vendor/autoload.php'; use Mirarus\DB\DB; use Mirarus\DB\Connect; /** * Driver Usage List * * --/Mysql * * Set Driver: mysql * Set DSN: 'mysql:host=localhost;dbname=testdb;charset=utf8', 'root', 'mysql' * * [localhost, testdb, root, mysql] Changed * * * --/MongoDB * * Set Driver: mongodb * Set DSN: 'mongodb://localhost', 'test' * * [localhost, test] Changed * * * /****\ * * Global Values * _DB * _DB__$driverName * */ /** * Connection Static Usage */ Connect::dsn('mysql:host=localhost;dbname=testdb;charset=utf8', 'root', 'mysql'); Connect::driver('mysql'); $db = new DB(new Connect); /** * Connection Return Usage */ $connect = new Connect(); $connect->driver('mysql'); $connect->dsn('mysql:host=localhost;dbname=testdb;charset=utf8', 'root', 'mysql'); $connect = new Connect('mysql', 'mysql:host=localhost;dbname=testdb;charset=utf8', 'root', 'mysql'); $db = new DB($connect); /* $result = $db ->insert('users') ->set([ 'name' => 'Ali', 'surname' => 'Güçlü' ]); $result = $db ->from('users') ->update([ 'name' => 'Ali X', 'surname' => 'Güçlü X' ], ['_id' => 14]); */ /*$result = $db ->update('users') ->where('_id', 14) ->set([ 'name' => 'Ali', 'surname' => 'Güçlüxxddds' ]); */ $result = $db->from('users')->all(); var_dump($result); var_dump($db); ?>
License
Licensed under the MIT license, see LICENSE