rrelmy / rorm
Simple lightweight ORM
Installs: 2 726
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-01-04 19:42:54 UTC
README
- Author: Rémy M. Böhler code@rrelmy.ch
- License: MIT
- Version: 0.1
Requirements
- PHP 5.3
PHP 5.3 requires a JsonSerializable
polyfill for the Model.
With PHP 5.5 we could ditch the QueryIterator
and use yield
.
Yield seems to have a little bit bigger memory footprint.
Goals
- Easy to use, easy to extend
- Minimalistic ORM
- Fast and low memory footprint
- compound key support
- Almost 100% test code coverage
TODO
- check for possible model loaded hook
- check if
autoId
could be ditched - consider
setExpr
(may be bad because until the model is loaded again the data is 'weird') - grouping/having support inside the
QueryBuilder
- Documentation
Ideas
- Cache
Usage
General
Model
QueryBuilder
Relations
There is no special support for relationships, but its easy to integrate them yourself.
Error handling
It is recommended to use the PDO exception error mode.
Rorm has no special error handling and does not catch thrown PDOException
's!
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Unbuffered queries
You can use unbuffered queries with the findMany method, but you have to be aware that no queries can be executed until the iteration is finished.
No special methods are supplied for configure unbuffered queries. You may use the PDO attributes yourself.
Multiple database connections
You can add multiple database connections to the Rorm config with the setDatabase($dbh, 'name')
method.
Each model can have a different database connection which can be configure with the $_connection
property.