Home » What are ORM Frameworks?
what-is-orm
PHP

What are ORM Frameworks?

ORM frameworks, short for Object-Relational Mapping frameworks, are an integral part of modern web development. They serve as the bridge connecting databases and code, simplifying data handling and allowing developers to work with databases in a more intuitive and object-oriented manner. In this guide, we will explore the world of ORM frameworks and understand how they revolutionize data management in software development.

PHP has it’s own library called PDO to do this. With the help PDO we can simply establish a connection, query, and fetch results in a way that we can use in our application.

When to use an ORM framework?

From my personal experience, an ORM framework becomes more useful as the size and complexity of the project increases. If you just have a simple database with say 5 tables and 5-6 queries … setting up an ORM framework may be overkill. I would start considering the use of ORM when:

  • You have 3 or more programmers on a web application.
  • Your database consist of 10+ tables.
  • You have say 10+ queries to make.

ORM frameworks can’t do it all

If you think that using an ORM framework will allow you to forget SQL and never have to look back, think again. Once you jump into the ORM world, you will find that about 80-90% of your queries can be handled by the ORM generated objects. It is inevitable that at some point you will need to drop down and use some SQL or some SQL like query language.

In fact, ORM frameworks often have their own *QL query language that looks a lot like SQL. Doctrine, a popular PHP based ORM framework has DQL (Doctrine Query Language) and the very popular Hibernate (used in the Java and .Net world) has HQL. Going even further, Hybernate allows you to write straight SQL if need be.

Despite the need for a SQL like language in ORM frameworks, they can still be very valuable tools in your PHP work.

There are several other libraries to achieve this in php

  • Aura SQL – Extension to the native PDO along with a profiler and connection locator.
  • DataMonkey – Database ORM for PHP build on top of Doctrine.
  • Doctrine – Home to several PHP libraries primarily focused on database storage and object mapping. The core projects are a Object Relational Mapper (ORM) and the Database Abstraction Layer (DBAL) it is built upon.
  • Eloquent – Illuminate Database component, used in Laravel framework but also a standalone component.
  • Medoo – Light PHP database framework to accelerate development.
  • Propel – A highly customizable and blazing fast ORM library.
  • ProxyManager – Library that aims at providing abstraction for generating various kinds of proxy classes.
  • RedBeanPHP – Easy to use ORM for PHP.
  • safemysql – A real safe and convenient way to handle MySQL queries.
  • Spot ORM – simple and efficient DataMapper built on Doctrine Database Abstraction Layer.
  • Zend\Db – Zend Database Component.

Add Comment

Click here to post a comment

37 + = 38