Corcel – Use WordPress backend with Laravel or any PHP application
github.com
github.com
Our family's e-commerce business previously had a slow and bloated WooCommerce site, largely due to my skill issues. However, we were able to rescue the site by using Corcel, Laravel, Filament, and LunarPHP.
My wife still uses the WordPress admin interface as the main admin tool, while the public-facing website is rendered by Laravel, with data provided seamlessly through Corcel.
For example, the product gallery is such all images - thumbs and main slides - load on page load. If you don't click any thumbs - and had 10 total images - 9 would have loaded for naught.
But there are BE + FE ways to fix that :)
Also, WooComm recently introduced HPOS that moved order meta into its own table. Smart! But there is still order data captured for every order (e.g., customer order IP, etc).that's in the meta table. Why those we're moved to the new table IDK.
Yeah, perhaps there are times when WP isn't the ideal choice from a pure technology POV, but there's more to it than that. For example, most (solo) devs complete dismiss the "getting hit by a bus" test. Sorry, but no one should accept advice from anyone who dismisses that test.
There might be better ways to increase profits.
At the same time, a day job and raising kids can make major technological transitions a real challenge. So, we are here, still stuck between 2 systems.
I took the WordPress-based / WooCommerce system and split it into 1) the Shopify system for admin stuff and also the whole payment system and 2) the "frontend" i.e. the consumer facing part BEFORE the payment (I used Symfony, similar to Laravel, but more modular and I was more familiar with it). Theoretically you could fetch all the product data via the Shopify API and then sync it automagically. But in the first iteration, we just copied some of the basic product data into a simple Symfony Admin backend and made a simple javascript-based checkout slide-out, and only when they were ready to pay, they would be forwarded to Shopify.
This way we would have full control of the user experience up to the point of purchase, and then Shopify would take over. I thought this was the best way I can deliver a performant website, while also being able to sleep well, because all the money stuff and all the customer data is handled by Shopify.
I was able to increase search engine traffic by 30% this way, reduce page size and increase page speeds and revenue increased significantly.
After 3 years, he decided he wanted to make it more "professional", so he fired me, I got none of the credit ("the search engine traffic must be because of better branding - and the page isn't up to my standards of aesthetics... yes, the designers who were supposed to deliver the designs kept stalling and delivered NOTHING and you had to just create something on the fly before the main selling season, and yes we had huge sales gains on the website and more traffic, but this was not because of the website"... they didn't change any of the marketing or any of their strategies, by the way.) So they hired an agency team with a project manager, designer, developer, marketing person; who then asked me to give them the source code from git so they can upload the code to their FTP server (!).
And they pretty much didn't change anything for a few years, everything looked the same. After like 4-5 years, they adjusted the design a bit, but still looked VERY similar.
I am in a very similar situation. Just it's not my families business. It's a friend e-commerce business that i supported & developed on the site for years. I wanted to move the product creation to a separate php application & sync via api. But those projects always explode.
How much time did you spend on this "migration"?
Is it a monolith? How does everything work together? What if you wanna leave the Wordpress DB schema behind at some point, would it be easy to "just" rewrite your backend models & DB schema?
Nifty tool for PHP projects that need to interface with Wordpress data.
With how large the Wordpress market is, this is probably desired by more teams than one could think of at a quick glance.
I can very much see the benefit of decoupling the front and back ends for these cases, especially since in most cases nowadays the public facing pages are pre-rendered/cached anyway. Also, I love Laravel.
As a former Drupal webdev, ProcessWire is heaven.
Kudos. Maintainability. It matters. I wish more devs realized that their DIY solutions are a disservice to the client once they leave the project.
WP has it (many) faults. But in general a good new dev can - with some effort - pick up where the ex-dev left off.
Clients should not loose sleep tracking down support for some esoteric megalomaniac-developer solution.
Not sure if this is a thing in Laravel yet but usually it's easy to generate ORM classes from an existing database. Symfony has it in their CLI tool, or had back in 2019 when I last used it.
We originally used Corcel with our Laravel installation, but somehow still found malware, so we immediately decommissioned the entire WordPress install and switched to Prismic. Prismic worked great and I regret switching to Strapi, but I felt the extensibility would be better (and latency reduced) if we self-hosted our headless CMS.
Managing Strapi is a full-time job, and their support for things like localization and their API are terrible. Don’t believe their marketing hype.
I also know they have open office hours on their Discord channel Mon - Fri 12:30 pm cst where you can get help and ask questions.
Direct database connections almost always are orders of magnitude faster, especially when joins are involved.
(This is speaking as someone who just migrated a site TO WordPress because it was still better than the previous system...)
I've got production PHP Lambda runtimes that predate Laravel Vapor by 7 years...
Do you have any write ups on PHP tooling? My feeling is that php tooling has a hard time handling stateless images, you often need to install plugins to php applications with a GUI with no good way to do it in a build process. Config of php applications is always an mix of php.ini and database config, often making monitoring a case of writing custom http requests and html parsing. I am not that happy with Java but there are many things it get right especially in tooling.
For PHP monitoring there are numerous modern solutions out there just a quick google search away.
Is it derived from "coerce", because it can be pronounced like "core cell"? Or something else? Or just a made-up term? :)
Could imagine people being genuinely grateful for being able to plug another PHP application onto WordPress for the frontend, if this works well.
Great idea!
1. does it work with any wordpress plugin? can i piggy back off laravel + frankenphp to scale what used to be nightmarish with wordpress?
2. does the underlying CMS UI still work for WP? Or is it built separately?
1. It looks like it only works with that which would be provided by WP by default. For example, the link below is an extension for working with Woocommerce. Given that WP doesn't even need to exist (you only need the WP DB) then you could use whatever setup is compatible with Laravel. You could also have separate environments with WP and Laravel sharing a remote DB.
2. Both WP and Laravel would work as if the other didn't exist. They only share the DB.
Later, I used React to talk to the WordPress API, exposing the Customiser config as JSON, then getting React to render pages based of this.
Either are better than having to deal directly with WordPress, though.