I’ve talked about reading your PHP Error Log using Console.app in a previous post, and it’s something I recommend reviewing.
Since that post, though, I’ve swapped to MAMP 4 and have asked my opinion on a variety of its features. Though I plan to do a more extensive post on this in the future, I thought it might be better for me to highlight a few things that are beneficial in shorter posts.
And you know I’m a fan of using a proper debugger, but I still stand by using the error log when working on your day-to-day work.
MAMP 4 was released recently, though, at the time, I was busy experimenting with Pressmatic. I think Pressmatic is a strong piece of software, though, for my day-to-day workflow, it doesn’t fully suit my needs.
So I returned to MAMP, and I’ve been thoroughly pleased with MAMP 4.
No, it doesn’t use a lot of the same technology some other applications do (such as virtual machines), but I’ve not found that to hinder the work I’m doing.
About four years ago, I shared a post about WP-CLI. It wasn’t exactly a new project at the time, but it was far less developed than it is now.
The WP-CLI Homepage
As I mentioned in yesterday’s post, one of the things that we’re doing with is making sure that all of our work is unit tested from the initial version.
And when it comes to unit testing in PHP, many of us are familiar with PHPUnit; however, when it comes to unit testing plugins that are integrated with WordPress, it helps to have a test environment set up.
Sure, it’s possible to set aside a test database, test content, and then defined mock objects based on interfaces (and I’m not here to dissuade anyone from doing that). But WP-CLI offers a much easier way to go about doing just that in a more automated manner.
But first, it’s important to make sure that it’s correctly installed on your system.
Every developer worth his or her weight will say writing quality code is key to making sure a project is maintainable over time.
What constitutes quality code may be subjective and this is not the post to debate that; however, if you’re working with PHP – especially alongside MAMP and WordPress – then I think using the PHP CodeSniffer is a tool we should all be using.
For those who’ve written both PHP applications and WordPress-specific applications, you know there are different standards used for writing code. Since this blog is primarily focused on the latter, then I’m obviously going to be focusing on that, but the steps provided aren’t altogether different for working strictly with PHP.
So here’s how you can setup PHP CodeSniffer, the rules for the WordPress Coding Standards, and how to have them run alongside MAMP.
When working with WordPress databases, we’re pretty fortunate to have tools like WP Migrate DB Pro, phpMyAdmin, Sequel Pro, and so on. But there are times when importing a large database is a bit more demanding than the front-end utilities we have.
Perhaps we have to change up our PHP configuration, perhaps we’re dealing with hundreds of megabytes worth of data, perhaps we don’t have the kind of control on the environment that we need.
Whatever the case, we always have the command line. And if you’re working with WordPress, MAMP, and you’re faced with importing large databases, then you may need to stop tweaking your PHP settings and simply import the file via the command-line.