Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iassasin/fidb
Fine Interface to Database
https://github.com/iassasin/fidb
database database-interface database-wrapper db php
Last synced: about 20 hours 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 (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T21:05:18.000Z (about 3 years ago)
- Last Synced: 2024-04-19T05:21:19.770Z (7 months 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)