开发者

Recommend a lightweight ORM / Active Record Library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the que开发者_运维技巧stion so it can be answered with facts and citations.

Closed 8 years ago.

Improve this question

I do not mind which pattern is used. I am just looking for something that is:

1) Lightweight

2) Under active development

3) Well documented

4) Supports MySQL

Can anyone recommend anything?


Not sure it qualifies as "lightweight", at least considering the number of source-files (that's not what makes something either slow or fast ;-) ), but if you are looking for a PHP ORM that is :

  • Under active development
  • Quite well documented
  • Support MySQL
  • Has support
  • Is one of the two most used PHP ORM
    • Which is probably one of the most import things...

Then, I would suggest you take a look at Doctrine.


There is also http://www.phpactiverecord.org/

php-activerecord is an open source ORM library based on the ActiveRecord pattern. It aims to massively simplify the interactions with your database and eliminate the chore of hand written SQL for common operations. Unlike other ORMs, you do not need to use any code generators nor maintain mapping files for your tables. This library was inspired by Ruby on Rails' implementation and therefore borrows many of its conventions and ideas. The best place to get started is by checking out the Guides below! The library is licensed under the MIT License and so you are completely free to do whatever you want with it.


Its either Doctrine or Propel, Doctrine currently has the upper hand in my opinion (Doctrine)


If you only want an ORM you can take the one in the http://micromvc.com framework - it is only 1 file and supports all four model relation types. (belongs_to, has_one, has_many, and has_many_through).

It does tie into the PDO database wrapper a tiny bit so you might have to edit the __construct() function.

The other option is TweetMVC which has a 1KB ORM. All-in-all, it's certainly the smallest.

No other libraries compare to the speed and size of these two.


Based on Jan-Fabry's answer on this question, I chose Propel as my trusted ORM and I don't regret it. It definitely meets the requirements you have mentioned and I give it credit for

  • being easy to learn,
  • being fast,
  • working seamlessly together with MySQL,
  • implementing the active record pattern, which means that you could switch to a different active record ORM some day, if Propel doesn't fit your needs anymore (unlikely ;)),
  • using an MIT-like license that legally fits into your projects.

I used Propel with Zend Framework and Zend Framework 2 projects, big and small. At the end the documentation is really good in my opinion. Everything is kept quiet simple.


Flourish: http://flourishlib.com/docs/ObjectRelationalMapping
ActiveRecord implementation, great documentation.

Flourish is intended to be more of a library of PHP code as opposed to a framework (defined as strict set of conventions, rules and methods that must be followed to build a site). In addition Flourish sits somewhere between the frameworks and ORM suites by providing some of the more advanced ORM features that most of the frameworks are missing, while being lighter weight and easier to use than the ORM suites.


Axon ORM has a database abstraction layer that requires no stupid xml/yaml configuration files. And there's no need to rebuild anything if you change your schema. Plus the fact that it truly is lightweight and has the ability to work with most major database engines: SQLite, MySQL, PostgreSQL, MSSQL, Sybase, etc. It's less than 15Kbytes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜