Faster Laravel Development with Tmux & Tmuxinator

Mahmoud Zalt
Jul 31, 2017 · 3 min read

Installation:

brew install tmux
gem install tmuxinator

Setup:

tmuxinator new {project-name}
# ~/.tmuxinator/sample.yml
# @author Mahmoud Zalt <mahmoud@zalt.me>
name: sample
root: ~/Codes/Projects/laravel/sample/
# run the following commands at the beginning:
# 1. (if you use docker): start docker if not already running (using boot2docker)
# 2. (if you use docker): run some docker containers (in this example I use one for mysql and another for redis)
# 3. open my code with an IDE `PHPStorm` (You can use any other IDE)
# 4. open my default browser `chrome` and go to my app URL (this command will automatically run your default browser but you can open a specific mrowser if you want)
pre: boot2docker up && docker start sample-mysql sample-redis && pstorm . && open http://sample.dev:8008/
windows:# window 1
- sample_1:
# the layout: I use a costum layout, however you can use any of the default layouts options [even-horizontal, even-vertical, main-horizontal, main-vertical, tiled] or generate your own layout by opening tmux then manually creating the panes and adjusting their sizes then exporting the layout with `tmux list-windows`.
layout: 69c9,158x44,0,0[158x37,0,0{79x37,0,0[79x18,0,0,0,79x18,0,19,1],78x37,80,0[78x8,80,0,2,78x14,80,9,3,78x13,80,24,5]},158x6,0,38,4]
panes:-
# here you can run whatever git command you want, I just used git status for the purpos of this simple file demonstration
- git status
# if you need you can migrate the data or perform any other artisan command
- php artisan migrate
# run the PHP built in server on a specific host and port
- php artisan serve --host=sample.dev --port=8008
# this log file location works for laravel 4 adjust it to laravel 5 (if you use daily logs then tat's hard to guess, I usually just list the directory then manuallt select the file)
- cd app/storage/logs && tail -f laravel.log
# if you use codeception as testing framework then include this line otherwise you can run whichever framework you are using
- codecept run
tmuxinator start {project-name}

Mahmoud Zalt

Written by

★ Software Engineer & More! ★ http://zalt.me

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade