PHPackages                             mrdulal/laravel-wp-connector - 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. mrdulal/laravel-wp-connector

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

mrdulal/laravel-wp-connector
============================

A Laravel package for WordPress database integration with Filament admin management

v1.0.0(7mo ago)502MITPHPPHP ^8.1CI failing

Since Oct 5Pushed 7mo agoCompare

[ Source](https://github.com/mrdulal/laravel-wp-sync)[ Packagist](https://packagist.org/packages/mrdulal/laravel-wp-connector)[ RSS](/packages/mrdulal-laravel-wp-connector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel WordPress Connector
===========================

[](#laravel-wordpress-connector)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2c57945cd247a2b68cd7f46c55f98af677cf5cfcc1f9d3296a9c706879425ba0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrdulal/laravel-wp-connector)[![Total Downloads](https://camo.githubusercontent.com/8de93ae01df9ebb52f200d0ddf0436c8862179b89c75b11780c0ff8781689c41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrdulal/laravel-wp-connector)[![License](https://camo.githubusercontent.com/458cc46074e1d2740b8780177c0413ba1e5d904a305ba0fef16aa6382aaefe18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrdulal/laravel-wp-connector)[![PHP Version](https://camo.githubusercontent.com/b330f7da546e134a0d01fab5d033ebaba61056e9d2dc9e2fd31c7c6fbf6a17fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mrdulal/laravel-wp-connector)[![Laravel Version](https://camo.githubusercontent.com/00b952940fdb058198f28166c9abf85975fb8d2e99eed5f746ec71e0060ba806/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e302532422d7265643f7374796c653d666c61742d737175617265)](https://laravel.com)[![Filament Version](https://camo.githubusercontent.com/755175749531a48d35e163888b3c8a38e8837d4a122c09949e70cd2eadcd48ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d332e302532422d626c75653f7374796c653d666c61742d737175617265)](https://filamentphp.com)[![Build Status](https://camo.githubusercontent.com/53add01218f56dc2c5d4da45d37563ecb30f5f4bcec301f483ce7a9b5b29ab37/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f722f63692e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/mrdulal/laravel-wp-connector/actions)[![Code Coverage](https://camo.githubusercontent.com/141c4fe4ba0cd6b941431ad09962103b9591d5e3f4deed1dbd151207f94af58b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6d7264756c616c2f6c61726176656c2d77702d636f6e6e6563746f723f7374796c653d666c61742d737175617265)](https://codecov.io/gh/mrdulal/laravel-wp-connector)[![Code Quality](https://camo.githubusercontent.com/8d5ef4d10b19aa974ed0fc5a1adb673b853806a872d600378afb100d7f779bd3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d5053522d2d31322d677265656e3f7374796c653d666c61742d737175617265)](https://www.php-fig.org/psr/psr-12/)[![PHPStan](https://camo.githubusercontent.com/a2913bbf90de520d5af638dc490d8f260e1a7c6a122168866a61a4604c844d08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e3f7374796c653d666c61742d737175617265)](https://phpstan.org)

A comprehensive Laravel package that seamlessly integrates WordPress database functionality into Laravel applications with full Filament admin panel support.

Features
--------

[](#features)

- 🔗 **WordPress Database Integration**: Connect to WordPress database with Eloquent models
- 🎨 **Filament Admin Panel**: Complete admin interface for managing WordPress content
- 📊 **Dashboard Widgets**: Real-time statistics and recent content widgets
- 🔍 **Advanced Queries**: Easy-to-use facade for complex WordPress queries
- 🏷️ **Relationships**: Full relationship mapping between WordPress entities
- ⚙️ **Configurable**: Publishable config with database connection options

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

[](#installation)

1. Install the package via Composer:

```
composer require mrdulal/laravel-wp-connector
```

2. Publish the configuration file:

```
php artisan vendor:publish --tag=wp-connector-config
```

3. Configure your WordPress database connection in `config/wordpress.php`:

```
return [
    'enabled' => true,
    'host' => env('WP_DB_HOST', '127.0.0.1'),
    'port' => env('WP_DB_PORT', '3306'),
    'database' => env('WP_DB_DATABASE', 'wordpress'),
    'username' => env('WP_DB_USERNAME', 'root'),
    'password' => env('WP_DB_PASSWORD', ''),
    'prefix' => env('WP_DB_PREFIX', 'wp_'),
];
```

4. Add your WordPress database credentials to your `.env` file:

```
WP_CONNECTOR_ENABLED=true
WP_DB_HOST=127.0.0.1
WP_DB_PORT=3306
WP_DB_DATABASE=wordpress
WP_DB_USERNAME=root
WP_DB_PASSWORD=your_password
WP_DB_PREFIX=wp_
```

Usage
-----

[](#usage)

### Basic Queries

[](#basic-queries)

```
use MrDulal\WpConnector\Facades\Wp;

// Get recent published posts with authors
$posts = Wp::posts()->published()->with('author')->latest()->take(5)->get();

// Get posts by category
$categoryPosts = Wp::postsByCategory('Technology');

// Get posts by tag
$tagPosts = Wp::postsByTag('Laravel');

// Get user count
$userCount = Wp::userCount();

// Get comment count
$commentCount = Wp::commentCount();
```

### Working with Models

[](#working-with-models)

```
use MrDulal\WpConnector\Models\WpPost;
use MrDulal\WpConnector\Models\WpUser;
use MrDulal\WpConnector\Models\WpComment;

// Get a post with its author and comments
$post = WpPost::with(['author', 'comments'])->find(1);

// Get user's posts
$user = WpUser::find(1);
$userPosts = $user->posts()->published()->get();

// Get post comments
$post = WpPost::find(1);
$comments = $post->comments()->approved()->get();

// Get post terms (categories/tags)
$post = WpPost::find(1);
$categories = $post->terms()->categories()->get();
$tags = $post->terms()->tags()->get();
```

### Meta Data

[](#meta-data)

```
// Get post meta
$post = WpPost::find(1);
$featuredImage = $post->getMeta('_thumbnail_id');
$customField = $post->getMeta('custom_field', 'default_value');

// Set post meta
$post->setMeta('custom_field', 'custom_value');

// Get user meta
$user = WpUser::find(1);
$firstName = $user->getMeta('first_name');
$lastName = $user->getMeta('last_name');
```

### WordPress Options

[](#wordpress-options)

```
use MrDulal\WpConnector\Facades\Wp;

// Get WordPress options
$siteName = Wp::option('blogname');
$siteDescription = Wp::option('blogdescription');

// Set WordPress options
Wp::setOption('custom_option', 'custom_value');
```

Filament Admin Panel
--------------------

[](#filament-admin-panel)

The package includes complete Filament resources for managing WordPress content:

- **Users**: Manage WordPress users with full CRUD operations
- **Posts**: Create, edit, and manage WordPress posts and pages
- **Comments**: Moderate and manage comments
- **Terms**: Manage categories, tags, and custom taxonomies

### Dashboard Widgets

[](#dashboard-widgets)

- **Recent Posts Widget**: Shows latest published posts
- **User Count Widget**: Displays user statistics
- **Comment Count Widget**: Shows comment statistics

Configuration
-------------

[](#configuration)

### Database Connection

[](#database-connection)

The package automatically sets up a WordPress database connection. You can customize the connection settings in the config file.

### Filament Configuration

[](#filament-configuration)

```
'filament' => [
    'navigation_group' => 'WordPress',
    'navigation_sort' => 1,
    'enable_widgets' => true,
],
```

Models
------

[](#models)

### WpUser

[](#wpuser)

- Primary key: `ID`
- Relationships: `posts()`, `comments()`, `meta()`
- Scopes: `published()`

### WpPost

[](#wppost)

- Primary key: `ID`
- Relationships: `author()`, `comments()`, `terms()`, `meta()`
- Scopes: `published()`, `type()`, `byAuthor()`

### WpComment

[](#wpcomment)

- Primary key: `comment_ID`
- Relationships: `post()`, `user()`, `parent()`, `children()`, `meta()`
- Scopes: `approved()`, `byPost()`

### WpTerm

[](#wpterm)

- Primary key: `term_id`
- Relationships: `posts()`, `taxonomy()`, `meta()`
- Scopes: `categories()`, `tags()`

Advanced Usage
--------------

[](#advanced-usage)

### Custom Queries

[](#custom-queries)

```
// Get posts with specific meta
$posts = Wp::posts()
    ->whereHas('meta', function ($query) {
        $query->where('meta_key', 'featured')
              ->where('meta_value', '1');
    })
    ->published()
    ->get();

// Get users with specific capabilities
$admins = Wp::users()
    ->whereHas('meta', function ($query) {
        $query->where('meta_key', 'wp_capabilities')
              ->where('meta_value', 'like', '%administrator%');
    })
    ->get();
```

### Relationship Loading

[](#relationship-loading)

```
// Eager load relationships
$posts = Wp::posts()
    ->with(['author', 'comments', 'terms'])
    ->published()
    ->get();

// Load specific relationships
$post = WpPost::with(['author.meta', 'comments.user'])->find(1);
```

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10.0+
- Filament 3.0+
- WordPress database

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Sanjaya Dulal](https://github.com/mrdulal)
- [All Contributors](../../contributors)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance64

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

220d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca21abbabdf7be6ae806e0e9d46c4a2944186168a99ebb14cf445f119d6d9eee?d=identicon)[mrdulal](/maintainers/mrdulal)

---

Top Contributors

[![mrdulal](https://avatars.githubusercontent.com/u/13785868?v=4)](https://github.com/mrdulal "mrdulal (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mrdulal-laravel-wp-connector/health.svg)

```
[![Health](https://phpackages.com/badges/mrdulal-laravel-wp-connector/health.svg)](https://phpackages.com/packages/mrdulal-laravel-wp-connector)
```

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

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