What are some recommended PHP ORM libraries for handling database relationships in custom MVC frameworks?

When building custom MVC frameworks in PHP, handling database relationships can be a complex task. One way to simplify this process is by using Object-Relational Mapping (ORM) libraries, which provide an abstraction layer for interacting with databases and managing relationships between database entities. Some recommended PHP ORM libraries for handling database relationships in custom MVC frameworks include Doctrine ORM, Eloquent ORM (part of Laravel framework), and Propel ORM.

// Example using Doctrine ORM
require_once "vendor/autoload.php";

use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;

$paths = array("path/to/Entity");
$isDevMode = true;

$dbParams = array(
    'driver'   => 'pdo_mysql',
    'user'     => 'root',
    'password' => 'root',
    'dbname'   => 'mydb',
);

$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);

// Now you can use $entityManager to interact with your database entities