Writing WordPress plugins is great fun because you can build awesome stuff and share it with tons of people very easily. Getting started can be frustrating because there are so many different ways to organize your code and it’s hard to know what’s best for your project. In the next few posts, I’ll share some of the […]
How To Use StepObjects in Cest Classes
Codeception can be used to write automated tests for PHP apps like you’d write with PHPUnit. In fact, Codeception uses PHPUnit under the hood to run unit tests. Codeception also has support for functional and acceptance tests. Here is a tip that took me over an hour of reading the Codeception source code to figure out. Hopefully this […]
Summary of PHP echo shortcut tag <?=
You may have read that using the short echo tag ( <?= ) should be avoided, especially for WordPress development. The convenience is really nice though, so here’s a quick summary of when you can safely use it in your code.
Unit Testing WordPress Plugins
If you are developing a WordPress plugin, it good idea to write some automated tests for it. Pound is a light weight WordPress plugin that will run tests you write for your own plugin. It’s not a framework or library and introduces no dependencies for your plugin. It just runs tests that your write […]
How PHP Frameworks Affect Profitability
Last week we talked about application shelf life an aspect of PHP development that often goes overlooked. This week let’s talk about how the web development framework you use contributes to the shelf life of your app and the profitability of your web application. Photo provided by Jonas Bengtsson
PHP vs Ruby – Application Shelf Life
I plan to write a series of posts about how we develop, deploy, and support our affiliate software and digital downloads applications. And why, after 5 years of Ruby on Rails development we switched back to PHP. One of the reasons is what I refer to as the shelf life of a web application. Let’s […]
PHP vs Ruby :: 2012 Year End Review
Back in 2007 I wrote an article titled PHP vs Ruby – Practical Language Differences which drew a fair amount of attention. Now that I’ve been working with Ruby in much more depth and both PHP and Ruby have matured dramatically over the past five years it is time to reevaluate the comparison.
camelCase to snake_case
Here is a TextMate command that will convert all of the selected text from camelCase to snake_case. This command is specifically designed for PHP. Thanks to PHP not having namespaces (until recently) many developers use PEAR naming conventions resulting in code that has class names like BP_Common::fancy_function(). This command will not convert the BP_Common.
If Statement Variable Scope In PHP
Variable scope is the context within your code in which a variable is defined and able to accessed. If you try to access a variable that is out of scope, the variable will be undefined and you will not get the results you are expecting. In PHP, variables all exist within the same scope when […]
WordPress register_activation_hook not firing
The register_activation_hook() in WordPress looks for the “wp-content/plugins” directory in the plug-in file’s canonical pathname. So, if your files physically live somewhere other than in your WordPress tree, WordPress (PHP) calculates inappropriate paths. The Solution: Move all your plug-in files into your WordPress tree and the activation hook should start firing.