maherremita / laravel-dev
A simple command to run and manage all necessary development servers and commands in separate terminals.
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/maherremita/laravel-dev
Requires
- php: ^8.2
- illuminate/console: ^9.0|^10.0|^11.0||^12.0
- illuminate/support: ^9.0|^10.0|^11.0||^12.0
Requires (Dev)
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^3.0
README
A Laravel package that allows you to launch and manage all your development servers and commands in separate terminal windows with a single Artisan command.
✨ Features
- 🚀 Launch all your development servers & commands with a single command.
- ➕ Create and manage commands at runtime, not just from the config file.
- 🖥️ Each process runs in a new, separate terminal window.
- 🎨 Customize terminal colors for each command for better visual organization.
- ⚙️ Interactive menu to start, stop, or restart individual or all commands while running.
- ✅ Cross-platform support for Windows, macOS, and Linux.
🚀 Demo
video.mp4
A quick demonstration of how Laravel Dev works.
📦 Installation
You can install the package via composer:
composer require maherremita/laravel-dev --dev
Next, publish the configuration file using the vendor:publish command. This will create a config/laravel_dev.php file in your project.
php artisan vendor:publish --provider="maherremita\LaravelDev\LaravelDevServiceProvider" --tag="config"
Usage
1. ⚙️ Configure Your Commands
Open the config/laravel_dev.php file and define the commands you want to manage. You can add as many as you need.
Static Commands
Define your commands as usual in the commands array:
'commands' => [ // Simple format 'Laravel Server' => 'php artisan serve', 'Queue Worker' => 'php artisan queue:work', // Advanced format with custom colors 'Vite Dev Server' => [ 'command' => 'npm run dev --watch', 'colors' => [ 'text' => 'Green', 'background' => 'Black' ] ], ],
Dynamic Commands
You can also generate commands at runtime, e.g. from the database or other sources. Use the dynamic_commands array for this. Each entry contains PHP code as a string, which is evaluated at runtime and must return an array of commands (like the commands array above).
Example:
'dynamic_commands' => [ 'colored_commands' => 'array_reduce( range(1, 3), function ($carry, $number) { $carry["Task {$number}"] = [ "command" => "echo Executing task {$number}", "colors" => ["text" => "green", "background" => "black"] ]; return $carry; }, [] );', // ... ]
Notes:
- The PHP code is executed with
eval()and must return an associative array. - Quotes must be escaped (
\'or\"). - The code must end with a semicolon (
;).
2. 🚀 Run the Dev Command
Start the master command by running:
php artisan dev
This will launch all the commands defined in your configuration file, each in its own terminal window. You will then see an interactive menu in the original terminal allowing you to manage these processes.
3. ⚙️ Manage Your Processes
Once running, you can choose from the following actions:
show all commands: Display a list of all configured commands.start command: Start a configured command that is not currently running.start all commands: Start all configured commands.stop command: Stop a specific running command.stop all commands: Stop all currently running commands.restart command: Restart a specific running command.restart all commands: Stop and then start all configured commands.refresh commands: Reload the configuration and update the list of commands.exit: Exit the interactive menu and stop managing processes.
🎨 Available Colors
You can set the text and background colors for each terminal window.
- Windows:
Black,DarkBlue,DarkGreen,DarkCyan,DarkRed,DarkMagenta,DarkYellow,Gray,DarkGray,Blue,Green,Cyan,Red,Magenta,Yellow,White. - macOS:
black,white,red,green,blue,cyan,magenta,yellow. - Linux:
Black,DarkBlue,DarkGreen,DarkCyan,DarkRed,DarkMagenta,Gray,DarkGray,Blue,Green,Cyan,Red,Magenta,Yellow,White.
🤝 Contributing
Contributions are welcome! Please feel free to submit a pull request.
- Fork the repository.
- Create a new branch (
git checkout -b feature/my-new-feature). - Make your changes.
- Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature/my-new-feature). - Create a new Pull Request.
📜 License
The MIT License (MIT). Please see License File for more information.
🙏 Credits
- Author: MaherRemita
- Email: maherr10203@gmail.com
⭐ Found this package helpful? Give it a star!