PHPackages                             rajivseelam/corcel - 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. rajivseelam/corcel

ActiveLibrary

rajivseelam/corcel
==================

Wrappers to collect data from Wordpress databases

6741PHP

Since Jun 27Pushed 11y ago2 watchersCompare

[ Source](https://github.com/rajivseelam/corcel)[ Packagist](https://packagist.org/packages/rajivseelam/corcel)[ RSS](/packages/rajivseelam-corcel/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Wordpress Corcel
================

[](#wordpress-corcel)

This package helps you integrate wordpress with your laravel installation.

Let's say you dropped your wordpress at *public/wordpress* and  open wordpress blog. But, may be, may be for some crazy reason you want use your Laravel routes and controllers to show off the blog, let's say at ! This way you can control the look, add blogs to any other pages, access that database all the while using wordpress admin.

Of course you can use Raw DB Statements to do this! But, What's fun in that! Corcel gives you Eloquent Classes to do that!

*Corcel is under development.*

Credit goes to Junior Grossi for starting this!

I have extended some of the functionality.

\--

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.

This way you can use Wordpress as back-end, to insert posts, custom types, etc, and you can use what you want in front-end, like Silex, Slim Framework, Laravel, Zend, or even pure PHP (why not?).

Installation
------------

[](#installation)

To install Corcel just create a `composer.json` file and add:

```
"require": {
    "rajivseelam/corcel": "dev-master"
},

```

Include the following in your public/index.php (So that we can WP functions)

```
define('WP_USE_THEMES', false);
require __DIR__.'/wordpress/wp-blog-header.php';

```

After that run `composer install` and wait.

Connecting to DB
----------------

[](#connecting-to-db)

You needn't do this if you are using WP along with Laravel.

First you must include the Composer `autoload` file.

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

```

Now you must set your Wordpress database params:

```
$params = array(
    'database'  => 'database_name',
    'username'  => 'username',
    'password'  => 'pa$$word',
);
Corcel\Database::connect($params);

```

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

```
'driver'    => 'mysql',
'host'      => 'localhost',
'charset'   => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix'    => '',

```

Usage
-----

[](#usage)

### Posts

[](#posts)

```
// All published posts
$posts = Post::published()->get();
$posts = Post::status('publish')->get();

// A specific post
$post = Corcel\Post::find(31);
echo $post->post_title;

// A specific post by slug
$post = Corcel\Post::slug($slug)->first();

```

You can retrieve meta data from posts too.

```
// Get a custom meta value (like 'link' or whatever) from a post (any type)
$post = Corcel\Post::find(31);
echo $post->meta->link; // OR
echo $post->link;

//Categories or Tags of a post
$post->categories();

$post->tags();

//Get thumbnail url
$post->thumbnail_url();

//Get the large version
$post->thumbnail_url('large');

//Find posts under a category

$category = Corcel\Category::where('slug',$slug)->first();

$posts = $category->posts();

//Find posts under a tag

$tag = Corcel\Tag::where('slug',$slug)->first();

$posts = $tag->posts();

```

### Categories and Tags

[](#categories-and-tags)

```
// Get all categories

$categories = Corcel\Category::all();

```

### Custom Post Type

[](#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
$videos = Post::type('video')->status('publish')->get();

// using your own class
class Video extends Corcel\Post
{
    protected $postType = 'video';
}
$videos = Video::status('publish')->get();

```

Custom post types and meta data.

```
// Get 3 posts with custom post type (store) and show its title
$stores = Post::type('store')->status('publish')->take(3)->get();
foreach ($stores as $store) {
    $storeAddress = $store->address;
}

```

### Pages

[](#pages)

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

```
// Find a page by slug
$page = Page::slug('about')->first(); // OR
$page = Post::type('page')->slug('about')->first();
echo $page->post_title;

```

### More

[](#more)

Dig through the code to find more!

Licence
-------

[](#licence)

Corcel is licensed under the MIT license.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f65a131fc8615471e846ba92fa2926668a0098fb1ebdf322a4d02525b28dbcd?d=identicon)[rjvim](/maintainers/rjvim)

---

Top Contributors

[![rajivvenuepick](https://avatars.githubusercontent.com/u/6366442?v=4)](https://github.com/rajivvenuepick "rajivvenuepick (11 commits)")[![jgrossi](https://avatars.githubusercontent.com/u/1175275?v=4)](https://github.com/jgrossi "jgrossi (1 commits)")

### Embed Badge

![Health badge](/badges/rajivseelam-corcel/health.svg)

```
[![Health](https://phpackages.com/badges/rajivseelam-corcel/health.svg)](https://phpackages.com/packages/rajivseelam-corcel)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
