Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wordpress Core Installer Laravel Package

johnpbloch/wordpress-core-installer

Composer plugin that installs WordPress core outside vendor, designed for setups with WordPress in a subdirectory and wp-content moved elsewhere to avoid updates wiping content. Supports custom install paths via wordpress-install-dir.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Misalignment with Laravel’s Monolithic Structure: Laravel’s project architecture (e.g., /public, /storage, /vendor) is fundamentally different from WordPress’s wp-content isolation needs. This package assumes a WordPress-centric filesystem layout, which conflicts with Laravel’s conventions.
  • Overlap with Existing Solutions: Laravel already handles dependency isolation via vendor/, composer.json, and autoload. The package’s primary feature (custom wp-content paths) is redundant if using Laravel’s storage/ or cloud storage (e.g., S3).
  • Hybrid App Limitation: Only useful if WordPress is a submodule (e.g., /wp) and not tightly integrated with Laravel’s routing, middleware, or service container. For full-stack Laravel-WP hybrids, alternatives like bedrock or wp-php are more robust.

Integration Feasibility

  • Low Direct Applicability: Laravel’s composer.json already manages dependencies without needing WordPress-specific installers. The package’s core logic (symlinking wp-content, customizing WP_CONFIG) is irrelevant unless:
    • WordPress is explicitly isolated in a subdirectory (e.g., /wp).
    • You’re using a multi-app setup where Laravel and WordPress share wp-content (e.g., for plugins/themes).
  • Conflict Risk:
    • Autoloading: Laravel’s vendor/composer/autoload.php may conflict with WordPress’s wp-includes/load.php if both are in the same project root.
    • Bootstrap Collisions: Only one framework can load first (Laravel’s bootstrap/app.php vs. WordPress’s wp-load.php).
    • Composer Plugins: This package registers a custom Composer plugin (wordpress-core), which could interfere with Laravel’s laravel/installer or spatie/laravel-package-tools.

Technical Risk

  • Stale Maintenance: Last release in 2020—risks incompatibility with:
    • Composer v2: While v2.0.0 claims support, untested in modern Laravel stacks.
    • PHP 8.x: Laravel 10+ requires PHP 8.1+, but this package’s tests may not cover new features (e.g., union types, attributes).
    • WordPress 6.x: Newer WordPress versions may rely on features this package doesn’t support.
  • GPL-2.0 License: May conflict with proprietary Laravel licenses or closed-source plugins.
  • No Laravel-Specific Testing: No evidence the package works with Laravel’s:
    • vendor/ structure.
    • config/ overrides (e.g., APP_URL, ASSET_URL).
    • Artisan commands or service providers.
  • Update Risks:
    • Running composer update could break Laravel’s autoloader if WordPress dependencies conflict.
    • WordPress updates might require manual wp-config.php adjustments (e.g., ABSPATH, WP_CONTENT_URL).

Key Questions

  1. Architectural Justification:
    • Why integrate WordPress with Laravel? Is this for a headless CMS, legacy migration, or feature-specific use (e.g., Gutenberg blocks)?
    • Could a microservice approach (separate Laravel + WordPress repos) avoid this complexity?
  2. Alternatives:
  3. Dependency Isolation:
    • How will Laravel’s vendor/ and WordPress’s wp-content coexist without conflicts?
    • Will plugins/themes in wp-content be version-controlled or managed separately?
  4. CI/CD Impact:
    • How will composer install interact with Laravel’s optimize or wp-cli commands?
    • Will updates trigger Laravel cache rebuilds or WordPress database migrations?
  5. Security:
    • Does this package validate WordPress updates against Laravel’s security policies (e.g., trustedproxies, csrf)?
    • How are WordPress nonces or Laravel CSRF tokens reconciled?
  6. Performance:
    • Could symlinking wp-content introduce race conditions during Laravel migrations or WordPress updates?
    • Will Laravel’s Opcache or WordPress’s object cache conflict?

Integration Approach

Stack Fit

  • Laravel-Unfriendly by Design: This package is optimized for WordPress monorepos, not Laravel’s modular architecture. Key misalignments:
    • Filesystem Layout: Laravel uses /public, /storage, /vendor; WordPress expects /wp-content, /wp-admin.
    • Dependency Management: Laravel’s composer.json is self-contained; this package assumes WordPress is a "first-class citizen."
    • Routing/Middleware: Laravel’s routes/web.php and WordPress’s wp-includes/rewrite.php cannot coexist without custom logic.
  • Possible (But Niche) Use Cases:
    • Option A: Laravel as an API Frontend for WordPress (e.g., using WP-API or Laravel Sanctum for auth).
      • Integration: Install WordPress in /wp, use Laravel to serve a Vue/React frontend.
      • Pros: Clean separation; WordPress updates don’t affect Laravel.
      • Cons: Duplicates auth systems (WordPress nonces vs. Laravel CSRF).
    • Option B: Legacy WordPress Site with Laravel Modernization (e.g., adding Tailwind CSS, Inertia.js).
      • Integration: Embed WordPress in /wp, use Laravel for new features.
      • Pros: Gradual migration path.
      • Cons: High maintenance burden for dual stacks.
    • Option C: Shared wp-content for Plugins/Themes (e.g., using Laravel’s storage/ as WP_CONTENT_DIR).
      • Integration: Symlink storage/app/wp-content to WordPress’s wp-content.
      • Pros: Centralized plugin management.
      • Cons: Risk of Laravel cache corruption during WordPress updates.

Migration Path

  1. Pre-Integration:
    • Audit Dependencies:
      • Run composer why-not johnpbloch/wordpress-core-installer to check for conflicts.
      • Verify Laravel plugins (e.g., spatie/laravel-wordpress) don’t overlap.
    • Isolate WordPress:
      • Create a /wp directory outside Laravel’s /public.
      • Initialize WordPress with this package:
        composer require johnpbloch/wordpress-core-installer --dev
        composer require wordpress/wordpress:^6.0 --type wordpress-core
        
    • Configure wp-config.php:
      define('WP_CONTENT_DIR', storage_path('app/wp-content'));
      define('WP_CONTENT_URL', asset('wp-content'));
      
  2. Core Integration:
    • Laravel Routing: Add to routes/web.php:
      Route::prefix('wp')->group(function () {
          require __DIR__ . '/wp/wp-blog-header.php';
      });
      
    • Asset Handling:
      • Exclude WordPress assets from Laravel Mix (mix.js()/mix.css()).
      • Use WordPress’s wp_enqueue_script() for dynamic assets.
    • Service Provider: Create a WordPressServiceProvider to bootstrap WordPress conditionally:
      if (!app()->runningInConsole()) {
          require __DIR__ . '/wp/wp-load.php';
      }
      
  3. Post-Integration:
    • Test Updates:
      composer update johnpbloch/wordpress-core-installer wordpress/wordpress
      php artisan optimize:clear
      
    • Validate Symlinks: Ensure storage/app/wp-content is correctly linked and writable.
    • CI/CD Pipeline: Add steps to:
      • Install WordPress core via Composer.
      • Run wp-cli for database setup (e.g., wp core install).
      • Cache Laravel config (php artisan config:cache).

Compatibility

Component Risk Level Mitigation
Composer v2 Medium Test with "config": { "platform-check": false } in composer.json.
PHP 8.x High Use platform.php or polyfills for deprecated functions.
Laravel 10+ High Patch this package or fork it for Laravel-specific fixes.
**
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium