Acorn bridges Laravel’s ecosystem into WordPress by leveraging Laravel’s core components (e.g., routing, validation, caching) while preserving WordPress’s native functionality. This hybrid architecture is ideal for projects requiring:
Key Fit Areas:
wpdb for complex queries.make:model, migrate) integrate with WP-CLI.Misalignment Risks:
Acorn\WordPress\Post).open_basedir) may limit Acorn’s functionality (see #512).Acorn is designed for Bedrock (Roots’ WordPress boilerplate) but can adapt to custom setups. Feasibility depends on:
wp-content location).composer.json may need autoload or extra.acorn keys.wp_loaded and shutdown to avoid conflicts with WordPress’s bootstrap.template_include).config/database.php).Technical Debt:
| Risk Area | Severity | Mitigation |
|---|---|---|
| Bootstrap Conflicts | High | Test early with ACORN_DEBUG=true; use Application::configure() to isolate components. |
| PHP Version Mismatch | Medium | Enforce PHP 8.3+ (Acorn’s min requirement); check composer.json constraints. |
| Performance Bottlenecks | Medium | Profile with Xdebug; lazy-load Laravel components (e.g., Cache::shouldUseDatabase()). |
| Hosting Limitations | High | Validate open_basedir, disable_functions, and PHP extensions (e.g., pdo_mysql). |
| Gutenberg/Blocks | Medium | Use Acorn’s Block facade or custom block types; test with @wordpress/create-block. |
| Queue Workers | Low | Ensure wp acorn queue:work is configured in routes/console.php. |
Critical Questions for TPM:
migrate) integrate with WordPress deployments (e.g., WP Engine, Kinsta)?Acorn is optimized for the following stack:
composer.json).Non-Native Integrations:
spatie/laravel-woocommerce or Acorn’s community packages.spatie/laravel-acf or custom field resolvers.Block facade or @wordpress/create-block with Laravel dependencies.| Phase | Actions | Tools/Commands | Risk |
|---|---|---|---|
| Assessment | Audit existing WordPress code for Laravel compatibility (e.g., replace get_posts() with Eloquent). |
php artisan acorn:about |
Low |
| Scaffold | Initialize Acorn in Bedrock or custom project. | composer require roots/acorn |
Medium (config complexity) |
| Hybrid Templates | Replace PHP templates with Blade (e.g., resources/views/page.blade.php). |
php artisan make:view |
Low |
| Routing | Migrate WordPress REST API or custom endpoints to Laravel routes (routes/web.php). |
php artisan route:list |
Medium (conflict with WP REST) |
| Data Layer | Replace wpdb queries with Eloquent models or queries. |
php artisan make:model Post |
High (schema mapping) |
| Authentication | Integrate Laravel Auth (e.g., illuminate/auth) with WordPress users. |
php artisan make:auth |
High (user sync complexity) |
| CLI/Automation | Replace custom WP-CLI scripts with Artisan commands. | php artisan make:command |
Low |
| Testing | Add PestPHP tests for Laravel layers; use WP-CLI for WordPress tests. | composer require pestphp/pest |
Medium (dual test setup) |
| Deployment | Configure Acorn’s queue workers and cron jobs alongside WordPress. | wp acorn queue:work |
High (scheduling conflicts) |
Rollback Plan:
composer.json backup without Acorn for fallback.ACORN_ENABLE_WORDPRESS_REQUEST_HANDLER=false.| Component | Compatibility | Notes |
|---|---|---|
| WordPress Core | High (tested with latest) | Avoid shutdown actions that conflict with Laravel. |
| Plugins | Medium (varies) | WooCommerce, ACF, and Yoast have community packages; others may need wrappers. |
| Themes | Low (without Acorn) | Requires Blade templates or custom theme wrappers. |
| Laravel Packages | High (most illuminate/* components) |
Unsupported: Broadcasting, Mail, Redis, Translation. |
| PHP Extensions | Medium | pdo, fileinfo, mbstring required; openssl for encryption. |
| Hosting | Low ( |
How can I help you explore Laravel packages today?