A Generic Data Objects ( https://github.com/rotexsoft/gdao ) implementation based on a stripped down version of idiorm (\LeanOrm\DBConnector). A light-weight, highly performant PHP data access library.
A light-weight, highly performant PHP data access library. Good alternative to Doctrine & Eloquent without all the bells & whistles that are not needed in most applications.
Version 2.X of this package has been rigorously tested against sqlite 3.7.11+, MySQL 8.0.29+ & Postgresql 15.1+.
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.
If you are using Sqlite, version sqlite 3.7.11 or higher is required.
Version 1.X of this package never got a stable release. Please use version 2.X+ of this package.
composer require rotexsoft/leanorm
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.
composer require --dev rotexsoft/leanorm-cli
You can set the environment variable LEANORM_PDO_DSN with a valid $dsn string for pdo e.g. LEANORM_PDO_DSN=sqlite::memory:
You can set the environment variable LEANORM_PDO_USERNAME with a valid $username string for pdo if needed e.g. LEANORM_PDO_USERNAME=jblow
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
LEANORM_PDO_DSN=sqlite::memory: LEANORM_PDO_USERNAME=jblow LEANORM_PDO_PASSWORD=some_password ./vendor/bin/phpunit --coverage-text
LEANORM_PDO_DSN="mysql:host=hostname_or_ip_address;dbname=blog" LEANORM_PDO_USERNAME="jblow" LEANORM_PDO_PASSWORD="some_password" ./vendor/bin/phpunit --coverage-text
- \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
Documentation for the non-stable 1.X version of this package is located at http://rotexsoft.github.io/leanorm/
Documentation for the most recent 2.X+ version can be found here.
Please submit an issue (preferably with a pull request) to address mistakes or omissions in the documentation or to propose improvements to the documentation.
PHPUnit Tests are set-up to run in a specific order in phpunit.xml.dist.
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.
New Test files must be manually added to the phpunit.xml.dist file in order for those new tests to run.