Talk to Laravel using GPT in the command line (pre-release beta)

Total Downloads

As a Laravel developer, I live in the command line.

I noticed that I have trouble remembering the exact syntax for commands, so I waste time looking up the same stuff...

  • What is Debugbar's name in composer?
  • What was the custom command I made last year?
  • Is it queue:start or queue:work?

So I made Speedrun – a package that turns ordinary sentences into Laravel commands. You can write like a human and GPT will figure out the right command for artisan, composer, and querying the database.

In other words...

  1. Type sr install debugbar
  2. Speedrun generates composer require barryvdh/laravel-debugbar

Install in ten seconds

composer require iambateman/speedrun

2. Set SPEEDRUN_OPENAI_API_KEY in .env

3. Run php artisan speedrun:demo

Optional: add the sr alias

To use sr instead of php artisan speedrun, add alias sr="php artisan speedrun" to your .zshrc file.


A few examples

The system is extremely flexible – it can understand almost any artisan command, composer package, or database query. Below are just a few ideas of the many ways you could use Speedrun.

Composer

sr install laravel excel
sr install filament

PHP Artisan

sr make keyword model with migration and factory
sr start queue

Custom app commands

Contextual to your app

sr generate sitemap
sr write articles for city 2

Query your Database

Also contextual

sr when did the newest user sign up
sr how many articles are attached to city 2

All of these will determine the command you're trying to execute and double check before running it.

Speedrun knows about your app's custom models and commands, so it automatically knows a shocking amount about your app without needing any configuration. It's honestly pretty uncanny.


Questions or Ideas?

Ping me on Twitter – @iambateman – or open an issue on Github! I'm open to ideas and pull requests.

Thanks for checking out the package, and I hope it works as well for you as it has for me!


Trigger words

Trigger database queries by starting with one of: find, query, who, what, when, where, why, or how.

Similarly, install Composer packages with: install, require, composer.

Any other starting word will trigger a `php artisan` command.


Tips for getting good output

  • Often, find produces better results than query.
  • The command line doesn't allow special characters, so use quotes when you need special characters: sr "query city->articles()"
  • Try 'pseudo natural' language – mixing English with proper Laravel syntax. Something like sr "query City::find(2) how many articles".
  • Right now, all application commands must start with app: in order for Speedrun to know about them.