Home  >  Article  >  Backend Development  >  Does PHP have an ORM?

Does PHP have an ORM?

(*-*)浩
(*-*)浩Original
2019-10-18 15:05:452886browse

ORM automatically persists the objects in the program to the relational database by using metadata that describes the mapping between the object and the database. Essentially converting data from one form to another.

Does PHP have an ORM?

ORM provides the generation of all SQL statements, and coders are far away from database concepts. Mapping from a conceptual requirement (such as a HQL) to a SQL statement costs nothing, not even 1% performance loss. The real performance hit is during the mapping process, and more specifically, during object instantiation. (Recommended learning: PHP video tutorial)

Currently, the more famous PHP open source ORMs include the following:

Propel

Propel is an ORM mapping (Object Relational Mapping) framework suitable for PHP5. It provides object persistence layer support based on Apache Torque. It generates SQL and classes through schema definition files in XML format and corresponding configuration files. It allows you to use objects instead of SQL to read and write records in database tables. Propel provides a generator to create SQL definition files and PHP classes for your data model. Developers can also easily customize the generated classes. We can also integrate Propel into existing application development frameworks through XML, PHP classes and Phing build tools. For example, versions before 1.2 of the PHP framework symfony are used by default. A streamlined version of Propel serves as the default ORM framework.

Doctrine

Doctrine is a PHP ORM framework. It must run on >=php5.2.3 version. It is a powerful data abstraction layer.

One of its main features is the use of object-oriented methods to implement database query sealing. Its bottom layer uses a DQL query statement similar to Hibernate HQL to perform database queries, which makes development more flexible. Greatly reduced duplicate code. Compared with Propel, the advantage of Doctrine is that it supports full-text search. Doctrine's documentation has always been more comprehensive and richer than Propel, the community is more active, and it is more natural, easier to read, and closer to native SQL. Performance is also slightly better than Propel. Similarly, you can easily integrate Doctrine into existing application frameworks. For example, the PHP framework symfony and later versions use Doctrine as the default ORM framework, and you can also integrate Doctrine with Codeigniter.

EZPDO

EZPDO is a very lightweight PHP ORM framework. The original intention of the author of EZPDO is to reduce the complex ORM learning curve and strike a balance between ORM operating efficiency and functionality as much as possible. It is the simplest ORM framework I have ever used so far, and I still want to integrate it. Come to my CoolPHP SDK, and the running efficiency is quite good, and the functions can basically meet the needs, but the update of ESPDO is relatively slow.

RedBean

RedBean is an easy-to-use, lightweight PHP ORM framework that provides support for MySQL, SQLite&PostgreSQL. The RedBean architecture is very flexible and the core is very simple. Developers can easily extend functions through plug-ins.

The above is the detailed content of Does PHP have an ORM?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn