It's been a long time coming, but Cargo is finally in alpha! 🎉
Cargo is basically a complete rewrite of Simple Commerce. It's been a massive amount of work, but I'm really happy with how it's turned out and I can't wait for you to try it out!
It's been a long time coming, but Cargo is finally in alpha! 🎉
Cargo is basically a complete rewrite of Simple Commerce. It's been a massive amount of work, but I'm really happy with how it's turned out and I can't wait for you to try it out!
Meilisearch is a super fast search engine that's easy to self-host on your own infrastructure, avoiding the need for another Saas subscription.
If you're using Laravel Forge, setting up Meilisearch is super simple:
.env
to point at the private IP address of the Meilisearch server:MEILISEARCH_HOST=http://10.0.0.6:7700
MEILISEARCH_KEY=key_from_forge
MEILISEARCH_INDEX=your_application
You can then use something like Laravel Scout to push your Eloquent models into Meilisearch and everything "just works".
I recently shared how I'm using Laravel Reverb outside of a browser to build a real-time webhook proxy.
Cargo (the new version Simple Commerce) is basically done. 🛍️
I recently invited a handful of folks into the GitHub repo to help me test things before I make it publicly available.
It's built on top of Statamic 6, so I'm planning to make the repo public when Statamic 6 goes into alpha/beta.
Then, I'm planning to tag a proper 1.0.0
around the same time as Statamic 6 is released.
Cargo includes a couple of big changes, including...
Cargo will be a paid upgrade. However, if you purchase Simple Commerce now, you'll be able to upgrade for free.
Cargo will automatically migrate your configuration options, orders, discounts for you, leaving you to update your code.
I can't wait to finally have it out there. It's been a long time coming (see my announcement post last year 😅).
Update: Cargo is now in alpha! Spin up a site and let me know what you think 🎉
After pairing with Ben Holmen last week, I've decided to open up my calendar and take part in the "Pair-amid Scheme".
I'm very much an introvert, so pairing with strangers is a little outside my comfort zone, but I'm hoping it's a good way to meet new people and learn from others.
We'll chat for a bit, then we can take turns on hacking on whatever we need to code that day, whether it's a side project, or a hard problem you need help solving.
It's nearly been five years since I started working on Simple Commerce. It started out as a way for me to play around with the Statamic 3 Alpha, but slowly and surely grew into the most popular way to build e-commerce sites with Statamic.
From the beginning, I wanted Simple Commerce to feel "native" to Statamic. It should take advantage of using entries to store products, it should tightly integrate with Antlers and seamlessly fit into the Statamic way of doing things.
I also wanted it to be simple to use - without getting in the way when you need to extend it to do something custom.
And from what I can tell from customer feedback, it seems like I've achieved that (🎉).
Over the last couple of months, I've realised that Simple Commerce has become pretty bloated and honestly not as polished of an overall product as I'd like.
So, after thinking about it for a while and doing some exploratory coding, I've decided it's time to rewrite Simple Commerce.
Laravel Herd now has first-party support for profiling, without needing to change any Xdebug settings. See their documentation: https://herd.laravel.com/docs/1/advanced-usage/profiler
I recently made the switch to Laravel Herd, after using Valet for years. Even though Herd is still using Valet under the hood, I've found it to be considerably faster than plain Valet.
One of the things I've been wanting to do for a while is to setup Xdebug in order to perform performance profiling, without needing to subscribe to a service like Blackfire.
Setting up Xdebug with Laravel Herd is pretty simple - you just have to follow a couple of steps on their docs to get it configured. Or, if you're using Herd Pro, it'll automatically enable Xdebug when it detects breakpoints in your code.
By default, Xdebug's debug
mode will be configured. However, in order to do profiling, we need to switch to its profile
mode instead, this involves a few additional steps:
Install Laravel Herd if you haven't already.
Enable Xdebug manually or purchase Herd Pro.
Herd Pro includes some pretty nifty features - like one-click setup for MySQL, Redis, Meilisearch, as well as local email debugging and dump logging (useful if you don't have a Ray license).
We need to append a short snippet to Herd's php.ini
configuration file in order to change the Xdebug mode. You can find Herd's php.ini
files at ~/Library/Application Support/Herd/config/php/<version>/php.ini
.
In addition to changing Xdebug's mode, it also sets the output directopry for the generated "cachegrind" files. I've got this set to the root of my project, but you're free to change this to where ever you like.
xdebug.mode = profile
xdebug.start_with_request = trigger
xdebug.output_dir = /Users/duncan/Code/Statamic/sandbox
In order for our changes in the php.ini
file to take affect, we'll need to reset Laravel Herd. You can do this from Herd's menubar menu:
Click "Stop all", then "Start all".
Next, in order for Xdebug to know you want to profile incoming requests, you'll need to install the Xdebug browser extension for whichever browser you're using (found in the Chrome & Firefox extension stores).
It'll add a little widget to your browser, allowing you to start and stop profiling sessions (or debugging sessions, if you switch back to debug
mode).
Finally, you'll need to "Start Listening for PHP Debug Connections" in PHPStorm.
After PHPStorm is listening, visiting a page in your browser will generate a cachegrind.out...
file in your chosen directory. The "Analyze Xdebug Profiler Snapshot" action will let you open this file and view the profiling snapshot.
If you ever need to switch back to debug
mode, simply comment out the additions in Herd's php.ini
file and restart Herd for the changes to take affect.
Note: I've only tested this on macOS, however, in theory, it should work the same way on > Windows but the php.ini
file will be different.
I've recently found myself going to the GitHub website multiple times a day to gather context on the code I'm looking at in my code editor.
I looked at some VS Code extensions which allow you to view a "git blame" inside VS Code but I didn't really like any of the ones I tried.... so I thought it'd be a fun evening project to build one.
Introducing "Simple Git Blame". Install it, go to a file, select a line (or multiple) and summon the action. The "Blame" page will open in your browser.
You can view the source code here.
An application I work on automatically generates & sends an spreadsheet export, with a few fields pre-filled. The user can then populate the rest of the data and upload it back into the application.
However, one of the fields that's part of that spreadsheet is an enum field. This means that whatever value that's used for the field in the spreadsheet needs to match exactly with the backing value of the enum.
After some digging, I found that I could add a 'select dropdown' to the relevant cells in the spreadsheet. The user could then select what they want from that dropdown and it'll match exactly... woo hoo! 🎉
I've just tagged the latest release of Simple Commerce, version 5. It includes a new concept of order & payment statuses, now supports Stripe Payment Elements out of the box, improves developer experience around building custom gateways & adds support for Statamic 4.
It's come a long way since it was released back in 2020. Let's dive into some of the big new features!