2017 © Pedro Peláez
 

library orm

lightweight object relational mapper

image

tflori/orm

lightweight object relational mapper

  • Saturday, October 28, 2017
  • by tflori
  • Repository
  • 5 Watchers
  • 11 Stars
  • 1,148 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 23 Versions
  • 3 % Grown

The README.md

tflori/orm

.github/workflows/push.yml Test Coverage Maintainability Latest Stable Version Total Downloads License, (*1)

Logo, (*2)

TL;DR Others suck, we can do it better., (*3)

Why to create another ORM? There are not enough ORM implementations for PHP already?, (*4)

Yes, there are a lot of implementations: - doctrine/orm - heavy: 8,8 MB of everything that you don't need, 6 direct dependencies with own dependencies - annotations that makes it unreadable - big amount of queries or very slow queries when it comes to join across multiple tables - propel/propel - still not stable 2.0-dev - even more heavy than doctrine - requires a lot of configurations - j4mie/idiorim and j4mie/paris - uses a lot of static methods and gets hard to test - not compatible to existing dependecy injection models - last update 2 years ago - everything in one file - ..., (*5)

This implementation will have the following features: - no configuration required - ok some bit for sure (e.g. how to connect to your database?) - of course this is only possible if you setup your database as we think your database should look like. If not you should only have to setup the rules of your system and naming conventions. - simple to use - lightweight sources - fast, (*6)

How to achieve this features? The main goal of Doctrine seems to abstract everything - at the end you should be able to replace the whole DBMS behind your app and switch from postgresql to sqlite. That requires not only a lot of sources. It also requires some extra cycles to get these abstraction to work., (*7)

This library will only produce ANSI-SQL that every SQL database should understand. Other queries have to be written by hand. This has two reasons:, (*8)

  1. You can write much faster and efficient queries
  2. We don't need to write a lot of abstraction (more code; more bugs)

This library will not fetch any mistake a developer can make. It aims to be a helper to store data in your database. Not to replace your database and your knowledge how to use this database. You can make a lot of errors - less than without this library but still a lot. When you make an error that is not catched (mostly we catch only mistakes that would cause a fatal error instead) you will get a PDOException., (*9)

Setup

Install it via composer, configure it, use it., (*10)

composer require tflori/orm
<?php

$entityManager = new ORM\EntityManager([
      ORM\EntityManager::OPT_CONNECTION => ['pgsql', 'mydb', 'postgres']
]);

$user = $entityManager->fetch(User::class, 1);

echo $user->username;

Read the docs for more information., (*11)

Known Issues

Composite Primary Keys

#52 Composite primary keys require SQLite >= 3.15 (or another database) to get the synchronization after insert working. The syntax used got added in SQLite 3.15., (*12)

Contribute

Please follow PSR-2 style guide and use this command to update the api reference documentation:, (*13)

$ docker run --rm --user $(id -u) -v $(pwd):/data -v $(pwd)/docs/_reference:/opt/phpdoc/data/templates/_reference iras/phpdoc2:2 phpdoc -c phpdoc.xml

Before creating a pull request please make sure that the unit tests are green and the coverage remains the same:, (*14)

$ docker run --rm --user $(id -u) -v $(pwd):/app -w /app iras/php7 vendor/bin/phpunit
### with coverage:
$ docker run --rm --user $(id -u) -v $(pwd):/app -w /app iras/php7 php -dzend_extension=xdebug.so vendor/bin/phpunit --coverage-text

The Versions

28/10 2017

dev-master

9999999-dev

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

28/10 2017

v1.3.0

1.3.0.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

28/10 2017

dev-feature-isset

dev-feature-isset

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

28/10 2017

v1.2.1

1.2.1.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

28/10 2017

dev-fix-datetime-conversion

dev-fix-datetime-conversion

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

20/06 2017

v1.2.0

1.2.0.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

20/06 2017

1.2.x-dev

1.2.9999999.9999999-dev

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

04/06 2017

v1.2.0-alpha1

1.2.0.0-alpha1

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

03/04 2017

v1.1.1

1.1.1.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

03/04 2017

v1.2.0-beta1

1.2.0.0-beta1

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

03/04 2017

v1.2.0-beta2

1.2.0.0-beta2

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

03/04 2017

dev-fix-noStfuOperator

dev-fix-noStfuOperator

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

11/02 2017

v1.1.0

1.1.0.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

11/02 2017

v1.1.0-beta1

1.1.0.0-beta1

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

11/02 2017

dev-feature-fetcherCount

dev-feature-fetcherCount

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

10/02 2017

v1.0.1

1.0.1.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

31/01 2017

v1.0.0

1.0.0.0

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

27/01 2017

v1.0.0-beta2

1.0.0.0-beta2

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

18/01 2017

v1.0.0-beta1

1.0.0.0-beta1

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

16/01 2017

v1.0.0-alpha4

1.0.0.0-alpha4

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

06/01 2017

v1.0.0-alpha3

1.0.0.0-alpha3

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

31/12 2016

v1.0.0-alpha2

1.0.0.0-alpha2

lightweight object relational mapper

  Sources   Download

MIT

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires

29/12 2016

v1.0.0-alpha1

1.0.0.0-alpha1

  Sources   Download

The Requires

  • php ^5.6 || ^7.0

 

The Development Requires