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

Acorn Laravel Package

roots/acorn

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

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:

  • Laravel’s tooling (Blade, Eloquent, Artisan) within WordPress’s CMS capabilities.
  • Progressive migration from WordPress to Laravel or vice versa.
  • Custom integrations (e.g., WooCommerce, ACF) via Laravel packages.

Key Fit Areas:

  • Template Rendering: Blade templates replace PHP/WordPress templates, enabling reusable components and Laravel’s view layer.
  • API/REST: Laravel’s routing and HTTP layer can coexist with WordPress REST API, enabling unified endpoints.
  • Data Layer: Eloquent ORM can supplement or replace WordPress’s wpdb for complex queries.
  • CLI/Automation: Artisan commands (e.g., make:model, migrate) integrate with WP-CLI.

Misalignment Risks:

  • WordPress-Specific Logic: Features like custom post types, taxonomies, or Gutenberg blocks require Acorn’s WordPress-specific wrappers (e.g., Acorn\WordPress\Post).
  • Performance Overhead: Dual bootstrapping (WordPress + Laravel) may introduce latency if not optimized (e.g., lazy-loading Laravel components).
  • Hosting Constraints: Shared hosting with PHP restrictions (e.g., open_basedir) may limit Acorn’s functionality (see #512).

Integration Feasibility

Acorn is designed for Bedrock (Roots’ WordPress boilerplate) but can adapt to custom setups. Feasibility depends on:

  1. Project Structure:
    • Bedrock compatibility is assumed; non-Bedrock projects require manual path/config adjustments (e.g., wp-content location).
    • Example: Custom composer.json may need autoload or extra.acorn keys.
  2. WordPress Hooks:
    • Acorn hooks into wp_loaded and shutdown to avoid conflicts with WordPress’s bootstrap.
    • Risk: Late-binding issues if Laravel components (e.g., middleware) run before WordPress filters (e.g., template_include).
  3. Database:
    • Supports dual databases (WordPress + Laravel) or a single shared schema (via config/database.php).
    • Caveat: Multisite requires explicit isolation (see #514).

Technical Debt:

  • Unsupported Laravel Components: Broadcasting, mail, Redis, and translation require custom implementations.
  • Session/Flash Data: WordPress page templates may lose flash data (fixed in #513) but require explicit handling.

Technical Risk

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:

  1. Migration Strategy:
    • Will this project gradually replace WordPress templates with Blade, or is it a hybrid approach?
    • How will existing plugins/themes (e.g., WooCommerce, Elementor) interact with Laravel layers?
  2. Team Skills:
    • Does the team have Laravel experience? If not, budget for training or documentation.
    • Are developers comfortable with WordPress hooks + Laravel service providers?
  3. Deployment:
    • How will Acorn’s Artisan commands (e.g., migrate) integrate with WordPress deployments (e.g., WP Engine, Kinsta)?
    • Are there CI/CD pipelines for both WordPress (e.g., Deployer) and Laravel (e.g., Envoyer)?
  4. Long-Term Viability:
    • Is this a proof-of-concept or a long-term architecture? Acorn’s roadmap may evolve (e.g., Laravel 14 support).
    • Are there alternatives (e.g., Laravel + WordPress as microservices) with lower coupling?

Integration Approach

Stack Fit

Acorn is optimized for the following stack:

  • PHP: 8.3+ (required for Laravel 13).
  • Composer: For dependency management (Bedrock uses composer.json).
  • WordPress: 6.0+ (tested with latest; check Bedrock compatibility).
  • Laravel: 13.x (core components only; no full Laravel app).
  • Databases: MySQL/MariaDB (primary); PostgreSQL/SQLite (secondary via Laravel).
  • Caching: Redis/Memcached (Laravel) or WordPress object cache.
  • Frontend: Vite (first-class support) or Webpack.

Non-Native Integrations:


Migration Path

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:

  • Use Git branches to isolate Acorn changes.
  • Maintain a composer.json backup without Acorn for fallback.
  • Document WordPress-only routes/templates to disable Acorn via ACORN_ENABLE_WORDPRESS_REQUEST_HANDLER=false.

Compatibility

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 (
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor