Download the PHP package mikenolimits/corcel without Composer

On this page you can find all versions of the php package mikenolimits/corcel. 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 corcel

Corcel

This package allows you to use WordPress as backend (admin panel) and retrieve its data using Eloquent, with any PHP project or even framework.

Travis Packagist Packagist

Follow @corcelphp on Twitter

Corcel is a class collection created to retrieve WordPress database data using a better syntax. It uses the Eloquent ORM developed for the Laravel Framework, but you can use Corcel in any type of PHP project, with any framework, including Laravel.

This way, you can use WordPress as the backend (admin panel), to insert posts, custom types, etc, and you can use whatever you want in the frontend, like Silex, Slim Framework, Laravel, Zend, or even pure PHP (why not?). So, just use Corcel to retrieve data from WordPress.

Installation

To install Corcel, just run the following command:

Usage

I'm using Laravel

If you are using Laravel you do not need to configure database again. It's all already set by Laravel. So you have only to change the config/database.php config file and set yours connections. You can use just one connection or two (one for your Laravel app and another to Corcel). Your file will look like this:

Now you should create your own Post model class. Laravel stores model classes in app directory, inside App namespace (or the name you gave it). Your Post class should extends Corcel\Post and set the connection name you're using, in this case wordpress:

So, now you can fetch database data:

I'm using another PHP Framework

Here you have to configure the database to fit the Corcel requirements. First, you should include the Composer autoload file if not already loaded:

Now you must set your WordPress database params:

You can specify all Eloquent params, but some are default (but you can override them).

Posts

Every time you see Post::method(), if you're using your own Post class (where you set the connection name), like App\Post you should use App\Post::method() and not Post::method(). All the examples are assuming you already know this difference.

You can retrieve meta data from posts too.

Updating post custom fields:

Inserting custom fields:

Advanced Custom Fields (ACF)

If you want to retrieve a custom field created by the Advanced Custom Fields (ACF) plugin, you have to install the corcel/acf plugin and call the custom field like this:

Custom Post Type

You can work with custom post types too. You can use the type(string) method or create your own class.

Using type() method will make Corcel to return all objects as Corcel\Post. Using your custom class you have the advantage to customize classes, including custom methods and properties, return all objects as Video, for example.

Custom post types and meta data:

Single Table Inheritance

If you choose to create a new class for your custom post type, you can have this class be returned for all instances of that post type.

You can also do this for inbuilt classes, such as Page or Post. Simply register the Page or Post class with the associated post type string, and that object will be returned instead of the default one.

This is particular useful when you are intending to get a Collection of Posts of different types (e.g. when fetching the posts defined in a menu).

Shortcodes

You can add shortcodes by calling the addShortcode method on the Post model :

If you are using Laravel, we suggest adding your shortcodes handlers in App\Providers\AppServiceProvider, in the boot method.

The thunderer/shortcode library is used to parse the shortcodes. For more information, click here.

Taxonomies

You can get taxonomies for a specific post like:

Or you can search for posts using its taxonomies:

Post Format

You can also get the post format, like the WordPress function get_post_format():

Pages

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

Categories & 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.

Menu

To get a menu by its slug, use the syntax below. The menu items will be loaded in the nav_items variable. The currently supported menu items are: Pages, Posts, Links, Categories, Tags.

To handle multi-levels menus, loop through all the menu items to put them on the right levels in an array. Then, you can walk through the items recursively.

Here's just a basic example:

Users

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

Authentication

Using laravel

You will have to register Corcel's authentication service provider in config/app.php :

And then, define the user provider in config/auth.php :

To make Laravel's Password Reset work with Corcel, we have to override how passwords are stored in the database. To do this, you must change Auth/PasswordController.php from :

to

Using something else

You can use the AuthUserProvider class to authenticate an user :

Running tests

To run the phpunit tests, execute the following command :

If you have the global phpunit command installed you can just type:

Contributing

All contributions are welcome to help improve Corcel.

Before you submit your pull request consider the following guidelines:

git checkout -b my-fix-branch dev

Licence

MIT License © Junior Grossi


All versions of corcel with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/database Version ~5.3.0
illuminate/contracts Version ~5.3.0
illuminate/support Version ~5.3.0
hautelook/phpass Version 0.3.4
thunderer/shortcode Version ^0.6.2
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 mikenolimits/corcel contains the following files

Loading the files please wait ....