PHPackages                             ignitekit/wp-orm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ignitekit/wp-orm

ActiveLibrary[Database &amp; ORM](/categories/database)

ignitekit/wp-orm
================

Laravel Eloquent inspired ORM package for WordPress

1.2.0(3y ago)4341GPL-2.0PHPPHP ^7.3|^8.0

Since Jun 25Pushed 3y ago2 watchersCompare

[ Source](https://github.com/IgniteKit/wp-orm)[ Packagist](https://packagist.org/packages/ignitekit/wp-orm)[ Docs](https://github.com/ignitekit/wp-orm)[ RSS](/packages/ignitekit-wp-orm/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

ORM for WordPress
=================

[](#orm-for-wordpress)

Laravel Eloquent based ORM for WordPress

This is a fork of the original library written by [Tareq Hasan](https://tareq.co) with some more improvements and changes.

### Package Installation

[](#package-installation)

To install the library run:

```
composer require ignitekit/wp-orm

```

### Usage Example

[](#usage-example)

#### Basic Usage

[](#basic-usage)

```
$db = \IgniteKit\WP\ORM\Eloquent\Database::instance();

var_dump( $db->table('users')->find(1) );
var_dump( $db->select('SELECT * FROM wp_users WHERE id = ?', [1]) );
var_dump( $db->table('users')->where('user_login', 'john')->first() );

// OR with DB facade
use \IgniteKit\WP\ORM\Eloquent\Facades\DB;

var_dump( DB::table('users')->find(1) );
var_dump( DB::select('SELECT * FROM wp_users WHERE id = ?', [1]) );
var_dump( DB::table('users')->where('user_login', 'john')->first() );
```

### Creating Models For Custom Tables

[](#creating-models-for-custom-tables)

You can use custom tables of the WordPress databases to create models:

```
