Download the PHP package janisbiz/light-orm without Composer
On this page you can find all versions of the php package janisbiz/light-orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package light-orm
Light ORM
A light ORM for php with easy to use query builder, repository generator and connection pool manager.
Installing
composer require janisbiz/light-orm
About
light-orm has been used for a while in some of my work related projects. As it was growing, I decided to open-source it for the rest of community. It has good unit test coverage and a great support for integration testing together with desired DMS using Behat.
Currently these DMS are supported:
- MySQL
There is still a lot work to do, so it would be great to have some contributors for future improvements
Examples
Connection pool
Connection pool is a singleton (yes I know...), which holds all the DMS connections used by ORM. To set-up connection pool you need to create a config for your DMS. Afterwards, you can add this config to connection pool, and it will establish connection to server only when it is required. To set-up connection pool, see example below:
Generator
Generator is built in repository and entity class generator. With generator, it is possible to make ORM easy to use. To use generator, you need to have pre-configured connection pool or one connection. To configure generator, see example below:
Repository & Query Builder
Repository is place where you can call query builder and then execute it against your configured DMS. Repository supports all basic CRUD actions against DMS, as well, it has built in paginator for result set pagination and result set count. To use query builder on repository, please see example below:
More examples?
To see full power of light-orm, please see test cases:
- For connection handling, see Connection Feature
- For generator handling(MySQL), see MySQL Generator Feature
- For repository handling(MySQL), see generated repositories with respective entity classes
Running tests
There are two ways to run tests: 1) By using docker containers:
- Copy
.env.dist
to.env
and adjust defined values for your needs - Execute
make start_dev
- Execute
make test
2) By using your local php and mysql database environment: - Ensure, that your php version is
7.1+
- Execute
composer install
- Execute
vendor/bin/phpcs --standard=phpcs.xml -p ./src -p ./tests; vendor/bin/phpunit; vendor/bin/behat;
TODO
1) Add support for other DMS than MySQL (preferably - Postgres) 2) Add migration support 3) Add event dispatcher