starlit / db
A lightweight database abstraction layer.
Installs: 43 918
Dependents: 3
Suggesters: 0
Security: 0
Stars: 3
Watchers: 5
Forks: 2
Open Issues: 1
Requires
- php: >=7.4
- ext-pdo_mysql: *
- starlit/utils: ^1.1
Requires (Dev)
- monolog/monolog: ^1.0
- nesbot/carbon: ^1.2
- phpunit/phpunit: ^5.7
Suggests
- monolog/monolog: If you want to use the provided Monolog database logger handler
- nesbot/carbon: Convert dateTime type into Carbon objects instead of DateTime
README
A lightweight database/PDO abstraction layer with an ORM like system for mapping data.
Currently only tested with MySQL.
Installation
Add the package as a requirement to your composer.json
:
$ composer require starlit/db
Usage example
<?php // Adding a user using SQL $db = new Db('localhost', 'db_user', '****', 'database_name'); $db->insert('users_table', ['name' => 'John Doe']); // Adding a user using object mapping $service = new BasicDbEntityService($db); $user = new User(); $user->setName('John Doe'); $service->save($user);
Requirements
- Requires PHP 7.4 or above.
License
This software is licensed under the BSD 3-Clause License - see the LICENSE
file for details.