Good PHP ORM Library?

2018-12-31 01:34发布

Is there a good object-relational-mapping library for PHP?

I know of PDO/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the domain model and the relational model. I'm looking for a PHP library that functions similarly to the way Hibernate does for Java and NHibernate does for .NET.

标签: php database orm
30条回答
梦该遗忘
2楼-- · 2018-12-31 01:55

PHP ORM Faces For PDO extension. See PHP Faces Framework.

$urun = new Product();
$urun->name='CPU'
$urun->prince='124';
$urun->save();
查看更多
孤独总比滥情好
3楼-- · 2018-12-31 01:56

If you are looking for an ORM that implements the Data Mapper paradigm rather than Active Record specifically, then I would strongly suggest that you take a look at GacelaPHP.

Gacela features:

  • Data mapper
  • Foreign key mapping
  • Association mapping
  • Dependent mapping
  • Concrete table inheritance
  • Query object
  • Metadata mapping
  • Lazy & eager loading
  • Full Memcached support

Other ORM solutions are too bloated or have burdensome limitations when developing anything remotely complicated. Gacela resolves the limitations of the active record approach by implementing the Data Mapper Pattern while keeping bloat to a minimum by using PDO for all interactions with the database and Memcached.

查看更多
倾城一夜雪
4楼-- · 2018-12-31 01:57

There are only two good ones: Doctrine and Propel. We favor Doctrine, and it works well with Symfony. However if you're looking for database support besides the main ones you'll have to write your own code.

查看更多
人气声优
5楼-- · 2018-12-31 01:58

Look into Doctrine.

Doctrine 1.2 implements Active Record. Doctrine 2+ is a DataMapper ORM.

Also, check out Xyster. It's based on the Data Mapper pattern.

Also, take a look at DataMapper vs. Active Record.

查看更多
残风、尘缘若梦
6楼-- · 2018-12-31 01:59

Check out Outlet ORM. It is simpler than Propel and Doctrine and it works similar to Hibernate, only with more of a PHP feel to it.

查看更多
像晚风撩人
7楼-- · 2018-12-31 01:59

Brazilian ORM: http://www.hufersil.com.br/lumine. It works with PHP 5.2+. In my opinion, it is the best choice for Portuguese and Brazilian people, because it has easy-to-understand documentation and a lot of examples for download.

查看更多
登录 后发表回答