https://github.com/iassasin/fidb
Fine Interface to Database
https://github.com/iassasin/fidb
database database-interface database-wrapper db php
Last synced: 3 months ago
JSON representation
Fine Interface to Database
- Host: GitHub
- URL: https://github.com/iassasin/fidb
- Owner: iassasin
- License: other
- Created: 2018-01-08T22:28:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T15:44:35.000Z (about 1 year ago)
- Last Synced: 2025-02-06T16:38:59.785Z (about 1 year ago)
- Topics: database, database-interface, database-wrapper, db, php
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fine Interface to Database
Very simple and lightweight database connection wrapper making easer and safer to construct queries.
# Install
Use composer to install `fidb`:
```
composer require iassasin/fidb
```
# Usage
```php
require_once 'vendor/autoload.php';
use Iassasin\Fidb\Connection\ConnectionMysql;
$db = new ConnectionMysql($host, $database, $user, $password);
$db->query('INSERT INTO table(num, str, txt) VALUES(%d, %s, %s)',
123, 'string', 'and "text"'); // automatic string escaping
// build queries of any complexity with variables
$bs = $db->select()
->column('str')
->table('table')
->where('num > %d', 30);
foreach ($bs->execute()->fetchAll() as $row){
echo $row['str'];
}
```
More examples see in [example](example/example.php)