Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/leeqvip/database
- Owner: leeqvip
- License: apache-2.0
- Created: 2018-10-16T15:28:01.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-23T10:31:23.000Z (about 2 years ago)
- Last Synced: 2024-09-25T12:14:33.729Z (about 2 months ago)
- Topics: database-library, orm, pdo, pdo-database-library, pdo-mysql, pdo-pgsql, pdo-php, php
- Language: PHP
- Size: 8.79 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).