Skip to content

Installation ​

Requirements ​

This package targets a stricter runtime than WordPress itself:

The package version follows the version of Eloquent it is built on: 13.x uses illuminate/database ^13.0.

TIP

To simplify the integration of this library, we recommend using WordPress with one of the following tools: Bedrock, Themosis or Wordplate.

Install the package ​

Install the package with Composer:

bash
composer require dbout/wp-orm

Then make sure the Composer autoloader is loaded, for example in your wp-config.php:

php
require __DIR__ . '/vendor/autoload.php';

🎉 That's all, the library is ready to use. There is no database configuration: the library uses the WordPress connection (the global $wpdb object), with the same credentials, charset, collation and table prefix.

NOTE

The models can be used as soon as WordPress has created $wpdb, i.e. anywhere in a must-use plugin, a plugin or a theme. Using a model earlier (e.g. directly in wp-config.php) throws an exception.

Optional features ​

Some features need extra packages:

FeatureRequirements
Migrationsilluminate/filesystem and WP-CLI
DB facadeA container, see Database connection

Next steps ​