- Can I use WPStarter to replace WordPress entirely with Laravel while keeping the existing database?
- WPStarter is designed for hybrid or gradual migration, not full replacement. You can map WordPress tables (e.g., `wp_posts`) to Eloquent models, but core WordPress functionality like the admin dashboard or plugins will still require WordPress. For full replacement, consider Laravel Sail or Forge without WordPress.
- How do I install WPStarter in an existing Laravel project?
- Run `composer require wpstarter/framework` in your Laravel project’s root. The package auto-detects WordPress and integrates hooks/filters via Laravel’s service container. Ensure your `composer.json` requires Laravel 10.x+ and WordPress 6.4+ for full compatibility.
- Will WPStarter work with WordPress plugins like WooCommerce or Advanced Custom Fields?
- Yes, but with caveats. WooCommerce or ACF can be accessed via WordPress’s global functions (e.g., `WC()->cart`), but complex interactions may require manual bridging. For Eloquent models, map custom post types/taxonomies to Laravel migrations. Test thoroughly with the plugin’s hooks.
- Does WPStarter support Laravel’s queues (e.g., Horizon) for background jobs?
- Yes, but ensure your hosting supports queues (e.g., a VPS with Redis). WordPress’s `wp_cron` may conflict with Laravel’s queue workers; use Laravel’s scheduler (`php artisan schedule:run`) instead. Offload heavy WordPress tasks (e.g., image processing) to Laravel queues.
- How do I handle caching conflicts between Laravel (Redis) and WordPress (Object Cache)?
- Configure Laravel’s cache driver to invalidate WordPress’s transients/object cache on write operations. Use `wp_cache_delete()` in Laravel’s cache listeners or extend the framework’s cache synchronization. For production, test with both Redis and WordPress’s default object cache.
- Can I use Livewire or Alpine.js with WPStarter for WordPress frontend interactions?
- Livewire and Alpine.js work seamlessly with WPStarter since they’re Laravel-first tools. For WordPress frontend (e.g., block editor), use Livewire components in custom blocks or enqueue Alpine.js via Laravel Mix. Avoid mixing WordPress’s `wp_enqueue_script` with Laravel’s asset pipelines.
- What Laravel versions and WordPress versions does WPStarter officially support?
- WPStarter is tested with Laravel 10.x+ and WordPress 6.4+. Older versions may require polyfills or manual overrides, especially for PHP 8.1+ features. Check the GitHub repo for version-specific branches or compatibility notes.
- How do I test a Laravel controller that interacts with WordPress hooks or shortcodes?
- Use Laravel’s testing helpers (e.g., `actingAs()`, `json()`) alongside WordPress’s testing utilities like `WP_Mock`. Mock WordPress globals (e.g., `$wpdb`, `get_current_user_id()`) in your test setup. For browser tests, use Cypress or Laravel Dusk to verify AJAX endpoints and shortcode rendering.
- Are there performance bottlenecks when mixing Laravel’s Eloquent with WordPress’s wpdb?
- Yes, especially for complex queries. Prefer Eloquent for new models and `wpdb` only for legacy WordPress tables. Profile with Laravel Telescope + Query Monitor to identify slow queries. Optimize by using Laravel’s query caching or read replicas for WordPress tables.
- What are the alternatives to WPStarter for Laravel-WordPress integration?
- Alternatives include custom Laravel plugins (e.g., using `wp_loaded` hooks), the `laravel-wordpress` package (older, less maintained), or building a headless WordPress setup with Laravel as the API backend. WPStarter stands out for its deep Laravel integration and modern tooling support (e.g., Vite, Pest).