oop

  • Model events do not fire on a mass update

    An observer that keeps a search index in step works perfectly until somebody writes a query builder update, at which point the rows change and nothing notices. This…

  • Laravel 5.6 and logging you can configure

    Logging moved into a config file, and stacks are why it matters — a different format per destination, decided without touching a service provider.

  • Symfony 4 and the bundle that does not exist

    A new project used to arrive with forty megabytes of vendor code and one route. The framework got smaller, and the interesting part is what happens at install…

  • The service provider you always end up writing

    Every service eventually needs the same provider: bind the interfaces, register the client with its credentials, and set up whatever the framework does not do on its own.…

  • The service container resolves callables too

    The container is usually described in terms of constructor injection, so a method needing one dependency for one call ends up either taking it in the constructor or…

  • Argument count errors are their own exception

    Calling a userland function with too few arguments used to be a warning that let execution continue with the parameter unset, which turned a call-site mistake into a…

  • Nullable types finally have syntax

    PHP 7.0 gave return types and no way to say a method might legitimately return nothing, so anything that could miss simply went untyped. 7.1 adds a leading…

  • Format bytes as a human readable size in PHP

  • Designing an API two mobile clients can live with

    Two apps, two release cycles, and neither can be forced to update. What is additive, what is not, and the decisions that have to be made before the…

  • void says the return value is not the point

    A method that exists for its effect has always returned null implicitly, which means a caller assigning its result gets something rather than an error. void makes the…