Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aidsoul/pdo
Lightweight, fast PDO query builder.
https://github.com/aidsoul/pdo
mysql-query-builder pdo pdo-php php
Last synced: about 4 hours ago
JSON representation
Lightweight, fast PDO query builder.
- Host: GitHub
- URL: https://github.com/aidsoul/pdo
- Owner: aidsoul
- License: mit
- Created: 2022-08-01T16:22:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-21T11:47:59.000Z (about 1 year ago)
- Last Synced: 2024-10-11T23:47:26.379Z (26 days ago)
- Topics: mysql-query-builder, pdo, pdo-php, php
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## PDO query builder
## Installation
Installation with the command:
```
composer require aidsoul/pdo
```
## Example Usage
```php
require_once __DIR__ . '/vendor/autoload.php';
use Aidsoul\Pdo\Db;$host = 'localhost';
$dbName = 'test';
$user = 'root';
$pass = '';$db = new Db("mysql:host={$host};dbname={$dbName}", $user, $pass);
// SELECT
$db->select()
->from('post')
->join('vkgroup')->on('group_id','id_group')
->orderBy(['id_post' =>'ASC'])
->limit(50)
->execute()
->fetchAll();// INSERT
$db->insert(['id_post','group_id'])
->into('post')
->values([66,28])
->execute();// DELETE
$db->delete()
->from('post')
->where('group_id','=',113)->and('id_post','=',147)
->execute();// UPDATE
$db->update('vkgroup')
->set(['name'=>'test'])
->where('id_group','=',111)
->and('name','=','before the test')
->execute();```