A few weeks ago we automated a portion of our inventory management system involving kits that contain several individual items. For example, one of the things that now happens is that when a product goes out of stock, all of the kits that contain that item now also go out of stock. Previously we managed this manually. Sometimes we’d mark the kit out of stock, sometimes we’d substitute a different product in, other times we’d ship a portion of the kit to customers and then the rest when it became available. It was all too much to manage manually at our current volume.
The programming itself wasn’t difficult, but the testing was because of how our development workflow goes. I start on my local machine, which runs WampServer. Once everything is working there, the code is pushed to our staging server, and then to the live server. For better or worse, the staging server uses the live database. I wouldn’t set it up this way again now, but sometimes with legacy software it’s not always a worthwhile exercise to blow things up that are more or less working.
In this particular instance though, there were a few problems. I couldn’t test with live inventory, so I needed to do all of my testing on my local machine. However, one of the limitations of my local environment is that it’s not set up to send email, and strategic email notifications to our team are a critical part of this inventory automation.
If you send email from your server like we do, sending email can be a challenge to set up locally. There are workarounds and tools out there, but they all seemed overkill for what I need. I really just need a way to see the components of the message – who it was sent to, what the subject was, what the headers were, that the content is, what time it was sent. I don’t much care if an actual email is sent or not (and in most cases, when testing, I’d prefer that it not be).
That’s when the proverbial light bulb went off. All of our email is actually sent through a single function in our own
I spent a few hours on a Saturday morning proving out the concept. It worked great! I signed up for an account and placed an order. Then I checked my new inbox, which I started referring to as my Localbox, to see the registration email and order confirmation.
It worked so helpful and was so simple that I decided to open source it. The project is called PHP Localbox and can be found at PHPLocalbox.com, with the full instructions and source code available on GitHub. I’ve installed it on a few other projects that I’m working on. It’s typically up and running in minutes, paying dividends right away. Hopefully other developers in a similar boat will find it useful.
Here’s a screenshot of your “inbox”. You can view or archive any message:
When you view a message, you can see all of the relevant information, followed by a preview of the actual message itself. This is loaded in an iframe, making it essentially the same as if the email content was outputted into your web browser. Everything is responsive, making it easy to test on mobile devices, and it supports both plain text emails and HTML messages like the one below:
Small side projects like this and Z.ips.ME are fun. I always learn a few new things in the process, and it feels good to launch something new, even if it’s something small and open source like this.
- Our Warehouse Package Cutoff System Wasn’t Designed For This, But It Is Saving Us Right Now
- Packing Slip Routing Optimization: How Our Expanded Warehouse Made Our Packing Slips Obsolete & How We Improved Them
- Programming Debt Paid
- A New Tool for Managing Busy Warehouse Days
- In-Depth: Overhauling Our Dropship System