https://github.com/justim/access
A simple MySQL wrapper optimized for bigger data sets
https://github.com/justim/access
database mysql php
Last synced: 8 months ago
JSON representation
A simple MySQL wrapper optimized for bigger data sets
- Host: GitHub
- URL: https://github.com/justim/access
- Owner: justim
- License: mit
- Created: 2019-06-04T16:56:42.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T10:17:57.000Z (over 1 year ago)
- Last Synced: 2025-01-31T22:11:24.287Z (over 1 year ago)
- Topics: database, mysql, php
- Language: PHP
- Homepage: https://access.justim.net/docs
- Size: 823 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Access
[](https://github.com/justim/access/actions/workflows/continuous-integration.yml) [](https://coveralls.io/github/justim/access?branch=master)
> A simple MySQL wrapper optimized for bigger data sets
## Quick usage
```php
class User extends Entity {
// ..
}
$db = Database::create('some PDO connection string');
$user = $db->findOne(User::class, 1);
$user->setName('Dave');
$db->update($user);
$users = $db->findBy(User::class, ['name' => 'Dave']);
// uses a generator
foreach ($users as $user) {
// $user is an instance of User
}
```
## Features
- Uses a PDO prepared statement pool for faster queries
- Optimized for bulk queries (ie. easy to fetch collections of collections)
- Easily present your entities as JSON without worrying about n+1 queries
## Requirements
- PHP 8.1, or higher
- PDO extension
## Installation
- Available at [Packagist](https://packagist.org/packages/justim/access)
- `composer require justim/access=dev-master`
## Docs
For now, see the tests for usage.
## Nice to have
- For now only MySQL and SQLite is supported, it would be nice to have support for more RDMSs, like Postgres
- Tests are currently run with an in-memory SQLite database, a MySQL database would be better
## Final notes
Currently used in a single production product, features are tied to this product.