A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.
https://j4mie.github.io/idiormandparis/
Idiorm and Paris are now considered to be feature complete as of version 1.5.0. Whilst they will continue to be maintained with bug fixes there will be no further new features added from this point on. This means that if a pull request makes breaking changes to the API or requires anything other than a patch version bump of the library then it will not be merged.
Please do not submit feature requests or API breaking changes as they will be closed without ceremony.
It is not recommended that you use either Idiorm or Paris in new projects.
I recommend that you use the Eloquent database library from Laravel as Taylor based it on Idiorm when he wrote it.
This means that many of the same ideas are present there, but it is more actively maintained and has a more modern code style.
You can continue to use both projects as they will continue to receive security patches and bug fixes.
It is important to note that future versions of PHP may not be supported if changes they require would break backwards compatibility.
At this point you can either use another database library such as Eloquent from Laravel (see If you’re starting a new project above) or you could decide to fork Idiorm and/or Paris to patch them with your own modifications.
For further information on the state of this project please see https://github.com/j4mie/idiorm/issues/360
A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5 and above.
Tested on PHP 5.2.0+ - may work on earlier versions with PDO and the correct database drivers.
Released under a BSD license.
See Also: Paris, an Active Record implementation built on top of Idiorm.
ORM
. Additional classes are prefixed with Idiorm
. Minimal global namespace pollution.find_many()
becomes findMany()
) - you’ll need PHP 5.3+The documentation is hosted on Read the Docs: idiorm.rtfd.org
You will need to install Sphinx and then in the docs folder run:
make html
The documentation will now be in docs/_build/html/index.html
$user = ORM::for_table('user')
->where_equal('username', 'j4mie')
->find_one();
$user->first_name = 'Jamie';
$user->save();
$tweets = ORM::for_table('tweet')
->select('tweet.*')
->join('user', array(
'user.id', '=', 'tweet.user_id'
))
->where_equal('user.username', 'j4mie')
->find_many();
foreach ($tweets as $tweet) {
echo $tweet->text;
}
Tests are written with PHPUnit and be run through composer
composer test
To make testing on PHP 5.2 (Idiorm maintains support back to this version of PHP) there
is a Docker setup in ./test/docker_for_php52
- check the readme in there for more.
null
to self::$_db
on reset_db()
to ensure PDO closes the connections [bleakgadfly] - issue #338selectMany()
[kawausokun] - issue #325raw_execute()
method and add a note for get_db()
in the querying documentation - [Treffynnon]is_dirty()
returns correctly when fed null or an empty string [tentwofour] - issue #268having_id_is()
reference undefined variable $value
[Treffynnon] - issue #224where_any_is()
[uovidiu] - issue #306composer test
script shortcut and fix PDO mock in test bootstrap [Treffynnon]where_id_in()
for selecting multiple records by primary key [lrlopez] - issue #202ORM::set_db(null)
) to make the test work again [borrel] - issue #160Patch update to remove a broken pull request - may have consequences for users of 1.4.0 that exploited the “find_many()
now returns an associative array with the databases primary ID as the array keys” change that was merged in 1.4.0.
find_many()
now returns an associative array with the databases primary ID as the array keys [Surt] - issue #133set()
and set_expr()
return $this
allowing them to be chained [Surt]get_config()
to access current configuration [javierd] - issue #141TOP
limit style (automatically used for PDO drivers: sqlsrv, dblib and mssql) [numkem] - issue #116WHERE
clauses [vicvicvic] - issue #140get_db()
[mailopl] - issue #106get_last_statement()
- closes issue #84 [tag]is_new
method - closes issue #85ArrayAccess
support to the model instances allowing property access via $model['field']
as well as $model->field
- issue #51ROWS
and TO
result set limiting and identifier quoting [mapner] - issue #98count()
and then find_many()
[fayland] - issue #97delete_many
[tag]set_expr
alone it doesn’t trigger query creation - closes issue #90int
when is float
sometimes required - closes issue #92order_by_expr
method [sandermarechal]set
method [sandermarechal]configure
method [jordanlev]select_many
and select_many_expr
- closing issues #49 and #69MIN
, AVG
, MAX
and SUM
- closes issue #16group_by_expr
- closes issue #24set_expr
to allow database expressions to be set as ORM properties - closes issues #59 and #43 [brianherbert]delete_many
method [CBeerta]find_array
to get the records as associative arrays [Surt] - closes issue #17_log_query
with ?
and %
supplied in raw where statements etc. - closes issue #57 [ridgerunner]is_dirty
methoddistinct
methodgroup_by
method