Making Multiple Instances Play Nice with Symfony’s Autowiring

Autowiring & Multiple Instances

Symfony's autowiring is one of the best things to come to the framework in the 3.X series. Without it we would all still be extending ContainerAware base classes and be using a service locator. But what if we need multiple instances of somethign in the container? The docs talk about dealing with multiple implementations of… Continue reading Making Multiple Instances Play Nice with Symfony’s Autowiring

Improving Symfony ChoiceType Error Messages

Symfony Choice Type Error Messages

The Symfony ChoiceType is a complex, interesting beast. By far my biggest complaint about it is the error messages shown to the user during validation are not great. Defaulting to, "This value is not valid," with no help for the user on what values are actually allowed. That's okay for plain HTML interfaces where the… Continue reading Improving Symfony ChoiceType Error Messages

Use Many S3 Buckets

use many s3 buckets

Should applications use one S3 bucket, putting different categories of files under different directories?1 Or should an application use multiple S3 buckets -- one for each different category of files? As the title implies, the answer is many S3 buckets. While some things, like lifecycle rules, can be configured based on directories (key prefixes, really),… Continue reading Use Many S3 Buckets

Posted in S3

Building an Upload System Backed by S3 and Client-Side Uploads

Client-Side S3 Uploads

One of the things I try to do when building applications is keep servers stateless. This makes those servers easy to throw away -- a piece of infrastructure failing (which it always will) is not a big deal with stateless servers. Just spin up a new one. When the requirement came down the pipeline to… Continue reading Building an Upload System Backed by S3 and Client-Side Uploads

How to Monitor Client-Side Upload Progress (with XMLHttpRequest)

XMLHttpRequest Upload Progress

Showing a user something like a progress bar during a file upload is handy and let's them know that stuff is working. Higher level abstractions like fetch don't really provide a look into how much of a request body has been sent, but good ol' XMLHttpRequest does. In order to monitor upload progress, attach an… Continue reading How to Monitor Client-Side Upload Progress (with XMLHttpRequest)

In PHP Use is More Like an Alias than an Import

PHP Use is an Alias

PHP has a use statement that allows the importing or, more accurately, aliasing of classes into the current namespace. In other languages, like Python, importing a nonexistent class or module will fail at the import. In PHP, this doesn't happen, instead the program will fail later when the aliased class, function, or constant is is… Continue reading In PHP Use is More Like an Alias than an Import

Posted in PHP