Download the PHP package wenprise/eloquent without Composer

On this page you can find all versions of the php package wenprise/eloquent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package eloquent

Credits

Thanks to:

  1. https://github.com/tareq1988/wp-eloquent
  2. https://github.com/corcel/corcel

Eloquent Wrapper for WordPress

This is a library package to use Laravel's Eloquent ORM with WordPress.

How it Works

Minimum Requirement

Package Installation

$ composer require wenprise/eloquent

Usage Example

Basic Usage

Posts

Pages

Pages are like custom post types. You can use Post::type('page') or the Wenprise\ORM\WP\Page class.

Comments

Meta Data (Custom Fields)

You can retrieve meta data from posts too.

To create or update meta data form a User just use the saveMeta() or saveField() methods. They return bool like the Eloquent save() method.

You can save many meta data at the same time too:

You also have the createMeta() and createField() methods, that work like the saveX() methods, but they are used only for creation and return the PostMeta created instance, instead of bool.

Querying Posts by Custom Fields (Meta)

There are multiples possibilities to query posts by their custom fields (meta). Just use the hasMeta() scope under Post (actually for all models using the HasMetaFields trait) class:

You can also use the hasMeta() scope passing an array as parameter:

Fields Aliases

The Post class has support to "aliases", so if you check the Post class you should note some aliases defined in the static $aliases array, like title for post_title and content for post_content.

If you're extending the Post class to create your own class you can use $aliases too. Just add new aliases to that static property inside your own class and it will automatically inherit all aliases from parent Post class:

Custom Scopes

To order posts you can use newest() and oldest() scopes, for both Post and User classes:

Pagination

To order posts just use Eloquent paginate() method:

To display the pagination links just call the links() method:

Post Taxonomies

You can get taxonomies for a specific post like:

Or you can search for posts using its taxonomies:

Categories and Taxonomies

Get a category or taxonomy or load posts from a certain category. There are multiple ways to achieve it.

Attachment and Revision

Getting the attachment and/or revision from a Post or Page.

Users

You can manipulate users in the same manner you work with posts:

Options

You can use the Option class to get data from wp_options table:

You can also add new options:

You can get all options in a simple array:

Or you can specify only the keys you want to get:

Writing a Model

The class name Employee will be translated into PREFIX_employees table to run queries. But as usual, you can override the table name.


All versions of eloquent with dependencies

PHP Build Version
Package Version
Requires illuminate/database Version ^8.0|^9.0|^10.0
illuminate/pagination Version ^8.0|^9.0|^10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wenprise/eloquent contains the following files

Loading the files please wait ....