See rates for the top Laravel developers in Latin America

Minimalist Sublime Text 3 Setup for PHP

Published on by

Minimalist Sublime Text 3 Setup for PHP image

While many developers are flocking to IDEs and other hybrids like Visual Studio Code, I’ve found myself trying to create a minimalist Sublime Text 3 setup. I am a minimalist at heart, and I like both my physical environment and virtual environment to be as minimal and tidy as possible.

I want to present to you the minimalist Sublime Text 3 setup that I’ve landed on, but still feel like I have most everything I need to be productive.

Built-In Features

The built-in feature I am most crazy about is the Goto -> Goto Definition.. and Goto -> Goto Reference:

Sublime’s code intelligence has improved drastically since earlier versions, and I don’t need PHP Companion for code intelligence like navigating to the source code of a method call.

I use the shortcut ⌥⌘↓ to go to definition dozens if not hundreds of times per day. If I need a quick reference of the method signature, this shortcut does the trick, and I can quickly jump back and forth between the definition and the current file with ⌘P⏎.

The Goto Anything and immediate hitting enter is a quick way to jump between two files for me.

If you are at a method definition you can use the Goto Reference to get a list of possible reference calls, in this example the Application::run() method:

The most apparent built-in feature you’ll use hundreds of times a day is Goto Anything with ⌘P. I use this all the time.

Additionally, I use Goto Symbol in Project dozens of times a day if I think I know the method name, but I need to confirm it.

I find that ditching the IDE has made my mind sharper when it comes to remembering library APIs I use every day. Each time I go for a method, instead of relying on auto-complete, I have a mini-quiz to see if I know the method name by heart.

If I end up forgetting the method name, I quickly jump to the class and search or use Goto Symbol to see a list of methods.

Last, I love this keybinding that is not configured by default, but is available out-of-the-box:

{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"}

With this key binding Control + Shift + r reveals the file I am currently working on in the sidebar. I like to use this to get a sense of the folder layout and other related classes of the current file I’m editing.

PHP Companion

Apart from Laravel-specific plugins like blade syntax highlighting (I will list my complete list of plugins later), PHP Companion is probably the only essential PHP plugin I need for Sublime.

I mostly use it for two features:

  1. Importing a namespace
  2. Expanding the full namespace of a class

I have these commands at my fingertips with keyboard shortcuts:

[
{ "keys": ["alt+t"], "command": "run_phpunit_test"},
{ "keys": ["super+alt+t"], "command": "run_single_phpunit_test"},
{ "keys": ["super+alt+l+t"], "command": "run_last_phpunit_test"},
{ "keys": ["super+shift+t"], "command": "run_phpunit_tests_in_dir"},
{ "keys": ["super+shift+ctrl+t"], "command": "run_all_phpunit_tests"},
{ "keys": ["super+alt+enter"], "command": "expand_fqcn" },
{ "keys": ["alt+enter"], "command": "find_use" },
{ "keys": ["f7"], "command": "insert_php_constructor_property" },
{ "keys": ["alt+shift+i"], "command": "import_namespace" },
{ "keys": ["ctrl+shift+r"], "command": "reveal_in_side_bar"}
]

Specifically, PHP Companion gives me the alt+enter to import a namespace at the top of the file, and if I need to expand the full namespace of a class I use super+alt+enter. I use the latter when I am defining @param ’s for methods.

The above snippet is my full list of keyboard bindings. I try to keep them minimal as well, and only a handful that I use over and over.

CLI Access

I like to open my code from the command line where I manage source control, or another way I sometimes open projects is through GitHub Desktop with Sublime configured as my editor.

I typically have ~/bin in my $PATH on Linux/Unix systems, so I symlink the subl CLI as follows:

ln -s \
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" \
/usr/local/bin/subl

Now from any folder, I can open it in Sublime as follows:

cd ~/Code/my-project
subl .

I also run my PHPUnit tests a lot during the day, so I use Adam Wathan’s Sublime PHPUnit plugin to run individual tests. It saves a ton of time as opposed to using something like the phpunit --filter flag.

Plugins

Here’s my complete list of plugins installed with Package Control:

  • AdvancedNewFile
  • DocBlockr
  • Dockerfile Syntax Highlighting
  • Laravel Blade Highlighter
  • PHPCompanion
  • Vuetify
  • Sublime PHPUnit (not in Package Control)

And that’s it!

Like I said at the outset, I like to keep things running as smooth as possible and as minimal as possible. I was using the Emmet plugin, but I found that it interferes with my Goto Definition shortcuts at the time of writing. The Goto Definition shortcut is my most used shortcut, so Emmet had to go.

Snippets

I tend to create a collection of snippets as I reach for them often. For example, on one project I was building a bunch of database table schemas and factory definitions by hand (long story), so I created a factory snippet for quickly creating a factory definition and states:

<snippet>
<content><![CDATA[
\$factory->define($1, function (Faker \$faker) {
return [
$0
];
});
]]></content>
<tabTrigger>factory</tabTrigger>
<scope>source.php</scope>
</snippet>

And I can define a factory state with factorystate:

<snippet>
<content><![CDATA[
\$factory->state($1, '${2:state}', function (Faker \$faker) {
return [
$0
];
});
]]></content>
<tabTrigger>factorystate</tabTrigger>
<scope>source.php</scope>
</snippet>

These are just a few examples that I use a ton, so I have snippets. I don’t have very many snippets. I don’t tend to install packages that contain snippets; I prefer to create a handful of them that I know I’ll use.

The four snippets I use the most include shortcuts for creating class methods as well as a PHPUnit test method.

First, I use the following daily to create public methods quickly with the pubf tab trigger (which matches PhpStorm’s shortcut):

<snippet>
<content><![CDATA[
public function $1()
{
$0
}
]]></content>
<tabTrigger>pubf</tabTrigger>
<scope>source.php</scope>
</snippet>

For protected methods, I use prof:

<snippet>
<content><![CDATA[
protected function $1()
{
$0
}
]]></content>
<tabTrigger>prof</tabTrigger>
<scope>source.php</scope>
</snippet>

And finally for private methods, I use prif:

<snippet>
<content><![CDATA[
private function $1()
{
$0
}
]]></content>
<tabTrigger>prif</tabTrigger>
<scope>source.php</scope>
</snippet>

For creating a new PHPUnit test method, I use test as my tab trigger:

<snippet>
<content><![CDATA[
/** @test */
public function $1()
{
$0
}
]]></content>
<description>Create a PHPUnit Test Case</description>
<tabTrigger>test</tabTrigger>
<scope>source.php</scope>
</snippet>

Code Linting

I don’t use a PHP code linter in Sublime, however, I do run CS on my code before merging pull requests, and sometimes on the whole codebase to do a little cleanup. I don’t want anything to drag my editor down, and use my console tools to clean up code style issues ¯\_(ツ)_/¯.

Learn More

Well, that’s it.

I have always been a text editor user, all the way back to the Textmate 1 days. As IDEs started getting better, I converted to PhpStorm for a while. I wasn’t happy with the experience. Fans ablaze, memory usage galore, and it just wasn’t for me. In fact, for me, an IDE felt like training wheels for code editing.

I am glad I made the switch back from an IDE setup to a super minimal Sublime setup that I am delighted with! I feel that I have better command over the code I work with, as well as a more familiar understanding of the APIs I consume daily.

The only thing I’d say is lacking is a good XDebug experience. I don’t mind firing up PhpStorm if I want to reach for XDebug. I pay for the PhpStorm license as a glorified XDebug client, and it does have the best debugging experience out there in my opinion :)

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Bacancy

Outsource a dedicated Laravel developer for $3,200/month. With over a decade of experience in Laravel development, we deliver fast, high-quality, and cost-effective solutions at affordable rates.

Visit Bacancy
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $3200/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Cut PHP Code Review Time & Bugs into Half with CodeRabbit logo

Cut PHP Code Review Time & Bugs into Half with CodeRabbit

CodeRabbit is an AI-powered code review tool that specializes in PHP and Laravel, running PHPStan and offering automated PR analysis, security checks, and custom review features while remaining free for open-source projects.

Cut PHP Code Review Time & Bugs into Half with CodeRabbit
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit

The latest

View all →
Laravel 12.44 Adds HTTP Client afterResponse() Callbacks image

Laravel 12.44 Adds HTTP Client afterResponse() Callbacks

Read article
Handle Nested Data Structures in PHP with the Data Block Package image

Handle Nested Data Structures in PHP with the Data Block Package

Read article
Detect and Clean Up Unchanged Vendor Files with Laravel Vendor Cleanup image

Detect and Clean Up Unchanged Vendor Files with Laravel Vendor Cleanup

Read article
Seamless PropelAuth Integration in Laravel with Earhart image

Seamless PropelAuth Integration in Laravel with Earhart

Read article
Laravel API Route image

Laravel API Route

Read article
Laravel News 2025 Recap image

Laravel News 2025 Recap

Read article