Parameter & Result Objects: More Than Grouping Values

Parameter and Result Objects

A parameter object replaces one or more parameters to a method with a single object instance. A result object is a object created specifically for a return value from a method. Parameter Objects Changing a method to accept a parameter object is a common refactoring for grouping parameters that belong together. Unfortunately that's not the… Continue reading Parameter & Result Objects: More Than Grouping Values

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

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