When I'm in an experimental mood, or working on a proof of concept, I like to code in a scrappy way. Anonymous functions allow me to avoid pausing my train of thought to think of a name for something. However, when I'm using the Symfony Console Component to write command-line utilities, it seems that I have to write a class for each command.
No more, I say!
I've created a tiny library called
beryllium/llama that lets me set the configuration and execution logic of console commands using anonymous functions, right in the constructor. When I found myself using the technique across several projects, I did what anyone would do - I gave it a silly name and threw it on GitHub and Packagist.