dbout / wp-orm
WordPress ORM with Eloquent and Phinx.
Installs: 3 955
Dependents: 1
Suggesters: 0
Security: 0
Stars: 63
Watchers: 3
Forks: 5
Open Issues: 9
Type:package
Requires
- php: >=8.2
- illuminate/database: ^11.0
- laravel/serializable-closure: ^1.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^1.12
- phpunit/phpunit: ^11.0
- rector/rector: ^1.2
- roots/wordpress: ^6.6
- szepeviktor/phpstan-wordpress: ^1.3
- yoast/phpunit-polyfills: ^3.0
Suggests
- illuminate/events: Add events to your models
- dev-main
- v4.0.0-alpha.1
- 4.0.0-alpha.0
- 3.3.0
- 3.2.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.2
- 3.0.1
- 3.0.0
- 3.0.0-beta.6
- v2.0.0
- v1.0.0
- dev-develop-4
- dev-v4/28-migration-tool
- dev-v4/db-schema
- dev-renovate/mysql-9.x
- dev-v4/33-transaction-commit
- dev-v4/88-json-support
- dev-v4/update-query-grammars
- dev-v4/update-licence
- dev-V4/add-tests
- dev-renovate/yoast-phpunit-polyfills-3.x
- dev-v4/update-dev-dependencies
- dev-v4/51-custom-comment
- dev-v4/72-meta-casting
- dev-v4/column-cast
- dev-v2/remove-phinx
- dev-renovate/major-illuminate
- dev-renovate/robmorgan-phinx-0.x
- dev-develop
- dev-v4/update-eloquent-to-v11
- dev-master
- dev-renovate/phpunit-phpunit-11.x
- dev-17-saveorfail-doesnt-throw-queryexception
This package is auto-updated.
Last update: 2024-10-19 16:55:25 UTC
README
Important
The phinx package will be removed in a future release in order to use the Laravel migration system. It is therefore advisable to stop using the tool. More info.
WordPress ORM with Eloquent is a small library that adds a basic ORM into WordPress, which is easily extendable and includes models for core WordPress models such as posts, post metas, users, comments and more.
The ORM is based on Eloquent ORM and uses the WordPress connection (wpdb
class).
💡 To simplify the integration of this library, we recommend using WordPress with one of the following tools: Bedrock, Themosis or Wordplate.
Features
- ✅ Support core WordPress models:
Comment
,Option
,Post
,TermTaxonomy
,Term
,User
,PostMeta
andUserMeta
- ✅ Support core WordPress post type:
Article
,Attachment
andPage
- ✅ Based on core WordPress database connection (
wpdb
class), no configuration required ! - ✅ Custom functions to filter models with meta
- ❤️ Easy integration of a custom post type
- ❤️ Easy model creation for projects with custom tables
- ❤️ All the features available in Eloquent, are usable with this library !
Not yet developed but planned in a future version:
- 🗓️ Create custom comment type
- 🗓️ Meta casting (e.g. Attribute Casting)
Documentation
This documentation only covers the specific points of this library, if you want to know more about Eloquent, the easiest is to look at the documentation of Eloquent :)
Installation
Requirements
The server requirements are basically the same as for WordPress with the addition of a few ones :
- PHP >= 8.1
- Composer
Installation
You can use Composer. Follow the installation instructions if you do not already have composer installed.
composer require dbout/wp-orm
In your PHP script, make sure you include the autoloader:
require __DIR__ . '/vendor/autoload.php';
🎉 You have nothing more to do, you can use the library now! Not even need to configure database accesses because it's the wpdb
connection that is used.
Contributing
We encourage you to contribute to this repository, so everyone can benefit from new features, bug fixes, and any other improvements. Have a look at our contributing guidelines to find out how to raise a pull request.