Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/leeqvip/database

PDO database library for PHP.
https://github.com/leeqvip/database

database-library orm pdo pdo-database-library pdo-mysql pdo-pgsql pdo-php php

Last synced: about 1 month ago
JSON representation

PDO database library for PHP.

Awesome Lists containing this project

README

        

# Database library for PHP

PDO database library for PHP.

the current supported databases are:

| type | database |
| ------ | ------ |
| mysql | MySQL |
| pgsql | PostgreSQL |
| sqlite | SQLite |
| sqlsrv | SqlServer |

### Installation

Use [Composer](https://getcomposer.org/)

```
composer require leeqvip/database
```

### Usage

```php
require_once './vendor/autoload.php';

use Leeqvip\Database\Manager;

$config = [
'type' => 'mysql', // mysql,pgsql,sqlite,sqlsrv
'hostname' => '127.0.0.1',
'database' => 'test',
'username' => 'root',
'password' => 'abc-123',
'hostport' => '3306',
];

$manager = new Manager($config);
$connection = $manager->getConnection();

$connection->query('SELECT * FROM `users` WHERE `id` = :id', ['id' => 1]);

$connection->execute('UPDATE `users` SET `name` = "joker" where `id` = :id', ['id' => 1]);
```

### License

This project is licensed under the [Apache 2.0 license](LICENSE).