There's a great article on dockblocks in tests that has some really good advice. Sometimetimes a good test name isn't enough and there should be some more context. Here are some other things I like to put in PHPUnit test docblocks. For Bugs & Bug Fixes In other words, I like to put the bug… Continue reading What to Put in Test Docblocks
Author: Christopher Davis
Logging to Papertrail from Symfony Applications
PMG uses Papertrail to aggregate logs and we've found it to be really solid over the last four years. Example Monolog Configuration Here's a quick example of configuration for Monolog Bundle to get logs to papertrail. This uses Monolog's remote syslog handler to do its work. Couple key points around the services here: PsrLogMessageProcessor is… Continue reading Logging to Papertrail from Symfony Applications
On Library Exceptions
https://twitter.com/chrisguitarguy/status/915313560036741120 I made this statement on twitter about PHP libraries throwing exceptions that I want to expand here. I'd say there are two broad categories of exceptions that a library might throw. Domain Exceptions These are specific to the library's domain. For instance, if I'm working with AdWords I know that AdWords account IDs take… Continue reading On Library Exceptions
A Recommended VPC Subnet Configuration
This is a recommendation on how to organize subnets inside an AWS VPC. Before continuing, it's important to understand the difference between a public and private subnet. There are three broad classes of subnets to run inside your VPC: Public Private Internal Internal subnets aren't really a thing, but it's a convenient way to talk… Continue reading A Recommended VPC Subnet Configuration
What’s the Difference Between a Public and Private Subnet in an AWS VPC?
This is a brief intro to quite a few of the AWS VPC components and how they fit together with the goal of describing the difference between a public and private subnet. Amazon has this line in some VPC docs that hints at the difference: The instances in the public subnet can send outbound traffic… Continue reading What’s the Difference Between a Public and Private Subnet in an AWS VPC?
How to Create New Autoscaling Groups on Lauch Configuration Change
Updating an auto scaling group's (ASG) launch config exposes a little quirk: the old instances are not automatically taken out of service. Sometimes that's not a bad thing. Running a distributed database in an ASG would make taking old instances out of service all at once a bad idea. Other times removing the old servers… Continue reading How to Create New Autoscaling Groups on Lauch Configuration Change
How to Update a Route53 Record on Instance Boot
I've been experimenting with running single instances in an autoscaling group. These single instances tend to be backing services that, while important, contain only ephemeral data that's okay being lost. A good example would be something like beanstalkd for a queue. Part of that process is registering the new instance with a Route 53 hosted… Continue reading How to Update a Route53 Record on Instance Boot
AWS Key Management Service Envelope Encryption in PHP
This is a PHP example of what AWS calls envelope encryption. Really this is just a way to use a key hierarchy rooted at a key management service (KMS) key. We'll use PHP 7.2's libsodium support (via paragonie/sodium_compat). The idea is that you have a customer master key that lives in KMS - this never… Continue reading AWS Key Management Service Envelope Encryption in PHP
Extracting GZIP Files with PHP
PHP comes with a nice zlib extension in its core. We're going to use it to extract a gzip compressed file. The steps here are pretty simple: Open the gzip file with gzopen Open the destination file with fopen Transfer the data from the gzip file to the normal file Close the open resources Most… Continue reading Extracting GZIP Files with PHP
Improving Tests One Name at a Time
Let's take a look at a simple object and a typical test. The code examples here are PHP, but this advice applies to any language or testing framework. Looks great right? I would argue that the test, while valid, is not as useful as it could be because the name of the test is terrible.… Continue reading Improving Tests One Name at a Time
