, (*1)
LeanOrm
Installation Requirements
PHP 8.1+ for versions 4.x & 5.x., (*2)
PHP 7.4+ for versions 2.x & 3.x, (*3)
Composer, (*4)
Versions 2.x & 3.x of this package have been rigorously tested against sqlite 3.7.11+, MySQL 8.0.29+ & Postgresql 15.1+., (*5)
Version 4.x & 5.x have been rigorously tested against:
- Sqlite 3.34.1+
- MariaDB 10.4.33+, 10.5.24+, 10.6.17+, 10.11.7+, 11.0.5+, 11.1.4+, 11.2.3+ & 11.4.2+
- MySql 5.6.51, 5.7.44, 8.0.36+, 8.1.0, 8.2.0, 8.3.0+ & 8.4+
- PostgreSQL 12.18+, 13.14+, 14.11+, 15.6+ & 16.2+
- See run-tests-against-multiple-db-versions.php, (*6)
MS SQL Server, is theoretically supported but hasn't been tested.
Will provide more updates on MS SQL Server support once testing
on that DB engine has been done., (*7)
If you are using Sqlite, version sqlite 3.7.11 or higher is required., (*8)
Version 1.x of this package never got a stable release., (*9)
Version 2.x+ of this package is stable & uses aura/sqlquery 2.8.0+ ., (*10)
Versions 3.x+, 4.x+ & 5.x+ of this package are also stable & use aura/sqlquery 3.0.0+., (*11)
Versions 2.x & 3.x mainly differ in the versions of aura/sqlquery their Model::getSelect(): \Aura\SqlQuery\Common\Select returns and
3.x has a few newer features like Model::fetchOneByPkey($id, array $relations_to_include = []): ?\GDAO\Model\RecordInterface., (*12)
Deprecated Utils::search2D(...) in 2.x has been removed in 3.x, (*13)
Version 5.x is not backwards compatible with 4.x., (*14)
Version 4.x is not backwards compatible with 3.x., (*15)
Versions 2.x, 3.x & 4.x are feature complete as of July 2024, only bug fixes will be applied to those versions., (*16)
Installation
composer require rotexsoft/leanorm
, (*17)
There's an accompanying command-line tool that can be used to automatically generate Model, Record & Collection classes for the tables and views in a database. To install this tool, just run the command below. Read the documentation for the tool for more information., (*18)
composer require --dev rotexsoft/leanorm-cli
, (*19)
Running Tests
./vendor/bin/phpunit --coverage-text
, (*20)
You can set the environment variable LEANORM_PDO_DSN with a valid $dsn string for pdo e.g. LEANORM_PDO_DSN=sqlite::memory:, (*21)
- For Postgres, the dsn must include dbname=blog and you should make sure a blog database exists in the Postgres instance. You don't need this for Sqlite, MariaDB or MySql, the database will be programmatically created.
You can set the environment variable LEANORM_PDO_USERNAME with a valid $username string for pdo if needed e.g. LEANORM_PDO_USERNAME=jblow, (*22)
You can set the environment variable LEANORM_PDO_PASSWORD with a valid $password string for pdo if needed e.g. LEANORM_PDO_PASSWORD=some_password, (*23)
For example:, (*24)
LEANORM_PDO_DSN=sqlite::memory: LEANORM_PDO_USERNAME=jblow LEANORM_PDO_PASSWORD=some_password ./vendor/bin/phpunit --coverage-text
, (*25)
LEANORM_PDO_DSN="mysql:host=hostname_or_ip_address" LEANORM_PDO_USERNAME="jblow" LEANORM_PDO_PASSWORD="some_password" ./vendor/bin/phpunit --coverage-text
, (*26)
GDAO Classes & Interfaces
Take a look at the code for the most up to date listing of methods, (*27)
, (*28)
LeanORM Classes
Take a look at the code for the most up to date listing of methods, (*29)
-
\LeanOrm\Model extends the abstract \GDAO\Model class
-
\LeanOrm\Model\Record & \LeanOrm\Model\ReadOnlyRecord both implement \GDAO\Model\RecordInterface
-
\LeanOrm\Model\Collection implements \GDAO\Model\CollectionInterface
, (*30)
Documentation
Documentation for the non-stable 1.x version of this package is located at http://rotexsoft.github.io/leanorm/, (*31)
Documentation for version 2.x version can be found here., (*32)
Documentation for version 3.x+ can be found here., (*33)
Documentation for version 4.0.x+ can be found here., (*34)
Documentation for version 4.1.x+ can be found here., (*35)
Documentation for version 5.x+ can be found here., (*36)
Please submit an issue (preferably with a pull request) to address mistakes or omissions in the documentation or to propose improvements to the documentation., (*37)
Contributing
PHPUnit Tests are set-up to run in a specific order in phpunit.xml.dist., (*38)
Yes, the best practice is for tests to run independently of each other,
but because there are fair amount of static methods in the DBConnector class,
its tests need to be run first before other Test Classes., (*39)
New Test files must be manually added to the phpunit.xml.dist file in order for those new tests to run., (*40)
Branching
These are the branches in this repository:, (*41)
-
master: contains code for the latest major version (5.x) of this package.
-
4.1.x: contains code for the 4.1.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
-
4.0.x: contains code for the 4.0.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
-
3.x: contains code for the 3.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
-
2.2.x: contains code for the 2.2.x versions of this package. Only bug fixes should be added to this branch. This branch is feature complete.
-
1.X: contains code for the 1.X versions of this package. This branch is abandoned.
-
gh-pages: contains documentation for the 1.X versions of this package. This branch is abandoned.