Building Package Installers

I think most of us that have worked with Laravel for a while are very familiar with the package installation process: add the package via composer, register the service provider, publish the config file, update the environment file, hopefully you remember to update .env.example, and after all of that you hope that you didnt miss a step. This often involved copying and pasting from a README and bouncing back and forth between your editor and a browser. With the release of Laravel 5.5 we got a pretty great improvement to this process with package discovery but outside of that this experience hasnt really changed much. At the time that I had started building the Honeybadger integration for Laravel, I had almost never seen install commands for PHP packages. The only one that came to mind was Laravel Spark. When we started outlining features for the integration, Josh suggested building an installation command similar to what they have in their Ruby gem. I thought this was a really neat idea that would make the installation process much smoother. I had some very specific goals for adding this feature I really didnt want this installer to just go off into the background, modify a bunch of your files, and just come back with a message that everything was successful. I also didnt want the output to be super verbose. I came across a great package by Nuno Maduro nunomaduro/laravel-console-task. I really loved the simple API and the beautiful output. However, there were some issues getting this to work with Lumen so I put together a simple class to gather task names and result statuses.

Read Full Article at