Posts List

Learning Bref - Day 1

I’ve been putting off learning how to deploy a PHP/Laravel app to a “serverless” environment for quite a while. A recent talk by Carl Alexander at Longhorn PHP finally gave me the push to try it out. This is the first in a series of posts documenting my experience as a longtime PHP developer checking out this topic in-depth for the first time.

AWS Error Retrieving Credentials

Recently I upgraded phpdotenv on an older project and my AWS connection stopped working. Why did one package upgrade break the other? And how did I fix it? Read on for details.

Solving the Mockery Error: Could not load mock, class already exists

This is a really specific error you might never run into, but when you do, this blog post is here for you.

One More Primary Key Example

Let’s wrap up this series of tips, and show one final example when setting an explicit primary key value can improve the quality of your tests.

Another Use Case for Explicit Primary Key Values

Yesterday I shared an example where setting explicit primary key values in your tests can make your tests more reliable. Let’s take a look at another example.

Testing Strategy: When to Use Explicit Primary Key Values

Based on the projects I’ve seen over the years, it’s a bit unusual to set an explicit primary key value when arranging the database state for a feature test. I’d like to share a few times when this strategy can make your tests more reliable.

An offer of help

From time to time, I see people lamenting how many sites are “stuck” on old versions of PHP. Other times, I see people dealing with poor (shared) hosting environments, manual deploys with FTP, no local testing environment, and so on. Instead of sitting back and shaking my head, I’ve decided to do something about it.

Date calculations are more complex than you think

Date and time manipulation is an area of programming that seems relatively simple on its surface, but lots of danger lurks just out of view. How hard could it possibly be to take a date/time and add 1 day to it? or 1 week? Piece of cake, right? You might do something like this: $eventTime = strtotime('2011-09-15'); //add one day to the date $newEventTime = $eventTime + (24 * 60 * 60); //expects 2011-09-16 and will USUALLY work echo date('Y-m-d', $newEventTime);

Finally, a PHP conference in Wisconsin

I’m a huge fan of php|architect: the magazine, the books, the online training and especially their conferences. Living in the Milwaukee metro area, I have a short 90 minute drive to the flagship php|tek conference they host in Chicago each year. My schedule doesn’t always allow me to attend, but I do everything I can to make it. I’m still putting into practice the things I learned at php|tek 2010 and I regularly keep in touch with the many friends I met there.

WordPress plugin for contextual dynamic text

WordPress has a concept called shortcodes. They’re very handy for inserting chunks of text or functionality with a simple text syntax. For example, one of the stock shortcodes allows you to type [gallery] in a post where you want a photo gallery to appear. But the real power is exposed when you start building your own shortcodes.