Tony Messias

September 9, 2023

Workbench App for Packages

Maintaining an open-source package requires a lot of effort. One problem I see in maintaining Turbo Laravel (and the other packages) is having an easy way to reproduce the reported issues. Suppose the person reporting the issue doesn't know the package internals that well (which is fine). In that case, they can still report the steps to reproduce it in a fresh app or, even better, create a demo app, put it in a public repository on GitHub, and share that with me. That works, but it's a lot of work.

My friend Jacob Baker-Kretzmar showed me a new package created by Mior called Workbench that lets us set up an example Laravel app inside our packages. This Workbench app can be used in your package's tests, and we can run the workbench app in the browser!

We can also do the normal Artisan workflows using the `testbench` CLI tool that comes with the package. For instance, here are the routes defined for the Workbench app I put together:

Screenshot from 2023-09-08 18-25-53.png

With the `testbench` CLI, we can generate models, migrations, controllers, components, etc. We can do everything that we'd typically do with Artisan on a Laravel app using `testbench` instead. And `testbench` will put the files in the correct folder inside the `workbench/` folder. It just works!

As I hinted before, what's extra cool about this package is that we can run `composer serve` and open this Workbench app in the browser! It's a normal Laravel application that has your package installed. It has everything you defined for the workbench app, like routes, controllers, models, migrations, views, etc.:


I'm super excited about it. I think this gonna be one of those packages that will be on every Laravel package that I maintain from now on. I recorded a video showing some of the workflows of using Workbench. You may check it out on YouTube.

About Tony Messias