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

Corcel Laravel Package

jgrossi/corcel

Eloquent-based models to query a WordPress database directly from Laravel or any Composer PHP app. Use WordPress as the CMS/admin backend while your app consumes posts, pages, taxonomies, options, menus, users, ACF fields, attachments, and more.

View on GitHub
Deep Wiki
Context7

Use WordPress backend with Laravel or any PHP application

Frequently asked questions about Corcel
How do I install Corcel in a Laravel 12 project?
Run `composer require jgrossi/corcel:^9.0` to install the latest version. Ensure your Laravel app shares the same database as WordPress. Corcel leverages Eloquent, so no additional setup is needed beyond configuring your `.env` database credentials.
Does Corcel support Laravel 12’s new app models or testing tools?
Corcel is compatible with Laravel 12 but may require minor customizations to fully utilize new features like app models. Test thoroughly, especially if using Laravel’s improved testing tools, as Corcel’s query builder may need adjustments for new Laravel 12 behaviors.
Can I use Corcel with WordPress 6.4+ without breaking changes?
Corcel monitors WordPress updates, but schema changes in newer versions may introduce breaking issues. Use feature flags or test in a staging environment before deploying. For critical projects, consider caching Corcel queries aggressively with Redis.
How do I handle WordPress user authentication in Laravel?
Corcel doesn’t integrate natively with Laravel’s Sanctum or Passport. Bridge WordPress users to Laravel’s auth system via custom events or a service layer. Sync roles/permissions manually or use a package like `spatie/laravel-permission` for role management.
Will Corcel work if WordPress and Laravel share the same database?
Yes, but shared databases can cause performance bottlenecks. Isolate WordPress in a separate database or container if your app is high-traffic. Corcel’s queries are optimized, but WordPress’s schema remains a potential overhead.
Are there alternatives to Corcel for Laravel-WordPress integration?
Yes. For lightweight needs, use the WordPress REST API directly with Laravel’s HTTP client. For deeper integration, consider `wp-api-php/client` or building custom Eloquent models. Corcel stands out for its Eloquent-based fluency and ACF support.
How do I cache Corcel queries to improve performance?
Use Laravel’s cache drivers (e.g., Redis) with Corcel’s query results. Wrap Corcel calls in `Cache::remember()` or use middleware to cache responses. For WordPress-specific queries, consider caching entire post/taxonomy lists.
Does Corcel support Advanced Custom Fields (ACF) in Laravel 12?
Yes, Corcel includes ACF integration out of the box. Access ACF fields via Eloquent relationships or direct methods like `$post->acf->field_name`. Ensure your WordPress site has ACF installed and configured before querying.
Can I use Corcel in a Symfony or non-Laravel PHP project?
Corcel is framework-agnostic but optimized for Laravel. In Symfony, you’ll need to manually bind Eloquent’s service container or use a bridge like `illuminate/support`. Test thoroughly, as some Laravel-specific features (e.g., facades) won’t work.
What’s the best way to test Corcel in a Laravel 12 app?
Use Laravel’s testing tools to mock Corcel models or database interactions. Test edge cases like custom post types, taxonomies, and ACF fields. For WordPress-specific tests, use Docker to spin up a fresh WordPress instance per test.
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