I built a GUI in the terminal (with PHP)
Solo for Laravel is a package to run multiple commands at once, to aid in local development. All the commands needed to run your application live behind a single artisan command `php artisan solo`. Each command runs in its own tab in Solo. Enjoy a powerful, unified development environment.
Everything I said
I mean, look at this. This is a GUI. We've got a scroll bar on the right. We can scroll up and down. Across the top, we've got tabs, and if you arrow over, it goes back around. And then let's say, oh, goodness, I don't wanna arrow over. We've got pop-ups. So you can hit the G key, and this pop-up comes up, and you can say, "I wanna go to the Make command." And once you're in the Make command, it sure looks like you should be able to type there.
In fact, you can type there. You can hit I to go interactive, and you can say, "I want to make a model." And okay, what kind of model do you wanna make? You know what? Actually, I'm not ready to do that. Let me exit interactive mode. I can come back later and finish that command if I want. Okay, what do we have here? This, this is a full-on... It's an application. It's, it's a GUI.
I guess technically it's a TUI. It's a, it's a textual user interface, but I built this entire app, um, as a command line tool in PHP. Why PHP? Because this is built for Laravel. I happen to love PHP. This is built for Laravel. The purpose of this is to run every single command you might need to run to run your Laravel application.
So you can tail the logs. You can run NPM Run Dev. You can start the queues. You can run a dump server when you wanna dump your variables somewhere besides on screen. You can run Reverb. You can run Pinch. You can run your tests. You can run it all in one command. In fact, everything you need is behind this one command called Solo. That is the name of this package.
This package is called Solo. It is for Laravel, and when you launch Solo, you get a bunch of commands across the top. You'll see that several of them are, um, are stricken through. Those are not running. And so this is just an About command that shows a nice little logo. Show... Tells you a little bit about the package. You can remove that. Now, if you come over to Logs, you'll see, well, this is a pretty good-looking set of logs.
In fact, if we look here, we'll see that the error is actually, um, highlighted in red, and then we're seeing a bunch of collapsed frames here because this is a specific, a very special command that I wrote that takes the logs from your Laravel application, looks for the vendor frames, and then collapses them.
And you can see we have a hotkey down here for Show Vendor. So if you're looking through your logs, and you're like, "Okay, I'm, you know, I'm up here, and I actually... You know what? I need to see all of the vendor frames," you can hit the V key, and boom, there are all the vendor frames. You see that this, this frame showed up out of nowhere. These got a lot wider.
And you can say, "Actually, no, that's a lot. I don't need to see all that." Let's turn vendor frames back off, and look, your scroll position stays in the same place. I spent way too long working on that, but it looks great. So you see we're viewing sixteen through thirty-one of sixty, and if you hit V, now we're doing forty-six through sixty-one of one fifty. Took a lot of math to figure that out, but we got there in the end.
Now, your vendor frames are collapsed, and you're like, "You know what? Um, okay, this is paused because I'm scrolling around." You can see in the top right, it's paused. And all right, I'm ready to start watching the logs again. I'm gonna hit F, and now we're following again. You'll see in the top right it has gone back to live, and so now any new logs are gonna pop in there. But, you know, I fixed the problem.
I don't wanna see these logs anymore. Down here, you'll see we've got truncate, so you can hit T to truncate that file and say, "All right, I'm just... I'm starting over." And you'll see what we're running here. We're running tail -f and one hundred, and then this is the long path to my log file, and you can just truncate it right from here. Now, over here, hey, some NPM errors.
Okay, so, um, you can run NPM Run Dev and have your VEET server up and running right here. Now, this is an interesting one. Laravel has a lot of make commands. You can run PHP Artisan Make Model. You can run, uh, Make Controller. You can run Make all kinds of things. What you can't do is just say, "Make.
Let's just make something," until now. I created a custom command, so you can, you can see this is running PHP Artisan Solo Make. And so this is not a Laravel command. This is a custom command that I made, and if you hit I, so look down here, you'll see this is an interactive command. So you can hit I to go interactive.
The, uh, the Chrome changes a little bit. It turns that nice cyan so that you know you're in interactive mode. You'll also see all the hotkeys went away down at the bottom, so if we exit interactive mode, you'll see the hotkeys come back down there. But once you're in interactive mode, you're actually just typing in the underlying command. So in this case, we want to create a model, and we wanna create a, uh, sure, a flight model.
And yeah, we'll add some of this stuff, and that looks good to me, and it's done. It says, "Look, finished PHP Artisan Make Model. Make another class." This is me speaking. Make another class, or you can hit, uh, Control-C to quit, or you can just say, "You know what? Just leave it running." Y- y- you don't have to kill the command.
Just leave it running. I am going to exit interactive mode now. Boom, we're out of interactive mode. We're back into Solo, and we can just kinda, and we can just kinda look around. Now, notice that a lot of these, so a lot of these are stricken through, right? A lot of these are, um, they're, they're not running. You'll see that by Stopped with the big red over there. There is such a thing as a lazy command.
So let's say you're working on an application, and sometimes you need some commands but not always, and you don't wanna start them all every single time because that can be annoying. You can add a lazy command. I'll show you how to do that in a second, but here is the result, is you get these commands, but they're not running. So what do you do?
You can s- hit S to start. So now if we start that, you'll see it is now running PHP Artisan Solo Dumps, and it is listening for dumps on this address right here. And so now whenever I, um, call, uh, dump in my Laravel code, it's gonna show up here instead of in my Laravel code. And once I've decided, like- Okay, I actually want it to show up in the right place again.
You can hit S again, and it will stop that command. Now, if it's running and you're like, "Uh, you know what? I just wanna restart this command for whatever reason," you can hit R and it will stop and start again. Again, R is down here, and that does restart. We've got, uh, reverb, and pent, and queues, and tests, and you can add your own.
Let me show you how you can add your own. This is all completely configurable. This is something you would install into your Laravel application, and then publish the configuration, and you can add your own commands. Let me show you how you do that. Right here at the top, we just have a little check to make sure that this doesn't end up in production, because this is not a production task runner, this is a development task runner.
So we just do a little check here, but then we get the good stuff. We've got themes. We've got a light theme and a dark theme. You can tell I am using the light theme. I am not insane, I just like light themes. So you can switch this to dark. I've tried to make everything environment variable driven, because I imagine, um, working in a team, people are gonna have different preferences.
I want light mode, everyone else in the world wants dark mode, and so I can set Solo theme to light, and it's gonna work just fine. I also, because the first thing, the first thing that happens when you ship something that has hotkeys is people are like, "Hey, where's Vim mode?" And I'm like, "Hey, what's Vim mode?" And so I added Vim mode. So we have some Vim hotkeys here, and you can change it from default to Vim.
You can also add your own key bindings if you want. If we look at the Vim hotkeys, it's pretty simple. We're just taking, um, previous tab and re- remapping it to H, and next tab and remapping it to L. So if you wanna go crazy, you can go crazy. You can do your own key bindings. I think you'll probably be okay with default or Vim, but what do I know?
Now, moving on, we've got the commands. So, um, you can do a couple of things down here. One is you can just, you can just pass a, a command. You can just pass the string, and that's what most of these are. Now, you can write your own command class that does some other stuff. So in this case, it does a lot of stuff.
So we have, here's that truncate file, um, but we've got toggle vendor frames, show vendor frames, hide vendor frames, and look at this. This is where we're, this is where we're looking through the lines to figure out what's a vendor frame and what's not a vendor frame, and how do I collapse it without losing the scroll? I don't know why I did this. I mean, it works great.
Um, this was not a good use of time. Anyway, going back here, um, so you've got all of those commands there. The make command is just, um, it's very, a very simple command, and then when stopping, we send a bunch of cancel to get out of the prompts. So you can kinda, you can kinda hook in to Solo if you write your own command. Um, but then you also have the ability to just add lazy commands.
So you can say command from, and then give it a string and say lazy. And these are the ones that don't auto-start but are available to you. So if you're working on a certain part of the stack and you need some of those commands, you can start them, and if you're working on a different part and you don't need them, you can just leave them stopped. If you're working in a team, you can add everything that might be useful, and then your, uh, teammates can decide, "Yeah, I wanna start these, or I don't wanna start those." And then finally, we just have at the very end, uh, the dump server host,
and that is, uh, what you saw put out on the screen there. So this is your configuration file. You can customize it to your heart's content. You can add literally any command that you want, including ones that you need to be, uh, interactive, and you can just hit that I key and go into the underlying command and start typing. I wanna show you one more thing, and that is the pop-up, the, um, quick nav, the, uh, go-to tab.
I think it's very cool, and I'm very proud of it. Okay, we're back here with a running instance of Solo, and you see down here we've got, uh, G for go, and if I hit G, boom, we have a pop-up. And everything behind, everything behind the pop-up is still going to run. So if you've got logs coming in, you'll see them behind the pop-up here, which I think is kinda cool. I, I, I made a pop-up on the, on the command line from scratch, and I'm kinda proud of it.
Now, this is great because, um, if you've got 10 processes, you can't be bothered to arrow over. You can just type D, and you'll go to dumps. And if you hit G again and hit L, you'll go to logs. And then it does remember the last one that you were on, so if you hit G again, it is already focused on dumps, and you can hit Enter just to hop back and forth the two that you were looking at most recently.
This is a, um, this is a hacked together Laravel prompt, um, that allows you to do a quick pick. So you can be down here, and even though you're not in the typing area, you can just say, "I wanna type," and then you type and you get to the place that you want to go. So I'm super proud of this. If you hit Q, it stops all of the processes, makes sure that every underlying process is dead.
I have a separate, uh, monitoring process that will make sure all children get cleaned up so we don't leave a bunch of stuff hanging around. I'm very proud of this. I will leave a link to it down below. It is called Solo. It is for Laravel. Let me know what you think. I would love to hear if this is going to be useful to you. See ya.