johnpbloch/wordpress-core
Composer-friendly WordPress core package that mirrors official releases for dependency management. Use it to pull WordPress into PHP/Laravel projects or custom setups, pin versions, and keep updates predictable without manually downloading or committing core files.
johnpbloch/wordpress-core) wraps WordPress, a monolithic PHP framework built on procedural + OOP patterns, into a Laravel-compatible package. This introduces a tight coupling risk with Laravel’s dependency injection (DI) and service container, as WordPress historically relies on global state ($wpdb, $post, etc.) and procedural hooks (add_action, add_filter).wpdb vs. Laravel’s DB facade).template_include vs. Laravel’s Blade).wp_posts, wp_options) must coexist with Laravel’s migrations.wp_users vs. Laravel’s users table (potential conflicts).init hook vs. Laravel’s middleware pipeline.wp_loaded hook may interfere with Laravel’s bootstrapping.wp_cron vs. Laravel’s queue workers.wp_enqueue_script vs. Laravel Mix/Vite.Schema::defaultStringLength(191) to avoid WordPress’s varchar(255) defaults.Route::group(['middleware' => 'web'], ...) to isolate WordPress routes.view() helper to render WordPress templates or vice versa.| Risk Area | Severity | Mitigation |
|---|---|---|
| Database Schema Conflicts | High | Custom migrations, table prefixes (e.g., wp_ vs. laravel_). |
| Hook/Middleware Collisions | High | Isolate WordPress hooks in a dedicated service provider. |
| Performance Overhead | Medium | Benchmark WordPress’s procedural code in Laravel’s OOP environment. |
| Security Gaps | High | Audit WordPress’s wp_ functions for SQLi/XSS (e.g., wpdb::prepare). |
| Dependency Bloat | Medium | Evaluate if WordPress’s wp-includes/ is necessary or if a subset suffices. |
| Long-Term Maintenance | Critical | Plan for WordPress core updates breaking Laravel integrations. |
Why WordPress?
Architecture Trade-offs
wp_signon vs. Laravel’s Auth) be unified?Team Expertise
Scaling Assumptions
WP_Cache vs. Laravel’s cache()) be harmonized?Future-Proofing
Laravel Compatibility:
$wpdb → app('wpdb')).get_post()) cannot be dependency-injected.Recommended Stack Additions:
DB facade for new tables; wrap wpdb in a service class.Route::prefix('wp', ...) to namespace WordPress routes.Phase 1: Proof of Concept (2-4 weeks)
wp_loaded hook timing).Phase 2: Hybrid Integration (4-8 weeks)
wp_ vs. app_) to avoid collisions./blog/* → WordPress).wp_users with Laravel’s users table via a model observer.Phase 3: Feature Parity (Ongoing)
wpdb::get_results vs. Eloquent).| Laravel Feature | WordPress Conflict | Solution |
|---|---|---|
| Eloquent ORM | WordPress’s wpdb queries |
Use DB::connection('wordpress')->select(...) or a custom repository. |
| Blade Templates | WordPress’s template_include |
Create a WordPressViewServiceProvider to resolve .php templates. |
| Middleware Pipeline | WordPress’s init hook |
Run WordPress hooks after Laravel middleware via a custom service provider. |
| Queues | WordPress’s wp_cron |
Disable wp_cron; use Laravel’s schedule:run command. |
| Authentication | wp_users vs. users table |
Implement a WordPressUser model extending Laravel’s User. |
| Service Container | Global $wpdb, $post |
Wrap globals in singleton services (e.g., app()->singleton('wpdb', ...)). |
Isolate WordPress
/wp/ subdirectory).Leverage Laravel for Non-CMS Logic
Incremental Plugin Integration
Performance Optimization
cache() for WordPress transients.wpdb).Illuminate\ and WordPress’s WP_ classes complicates error trackingHow can I help you explore Laravel packages today?