PhpStorm Cheatsheet - Laravel & Symfony Shortcuts
PhpStorm’s edge over a plain editor is framework awareness — it knows Laravel/Symfony routes, models and containers. This reference groups PHP generation, framework jump, database, debug/run and quality shortcuts on the JetBrains keymap. Use the framework-navigation keys to hop between a route, controller and blade/twig template without grepping. For PHP work where navigating an unfamiliar codebase is the daily cost. After reading you refactor and jump through a PHP app without breaking stride.
Typical Use Case
For developers maintaining PHP projects, especially those spanning Laravel or Symfony who would rather not jump between editor, database client and debugger. Grouped into PHP-specific keys, Laravel keys, Symfony keys, the database tool window, debugging and code quality. The high-value entries are code generation and refactoring shortcuts, navigation along the inheritance chain, framework-aware jumps between routes, views, controllers and models, and running SQL against a live database without leaving the IDE.
PHP-specific 10
Cmd + NCmd + Option + TCmd + Option + MCmd + Option + VCmd + Option + CCmd + PCmd + BCmd + UCmd + Option + BCmd + Option + HLaravel-specific 7
Cmd + Option + LCmd + Option + VCmd + Option + CCmd + Option + MCmd + Option + PCmd + Option + RCmd + Option + TDatabase Tools 6
Cmd + Shift + F2Cmd + Option + ReturnCmd + F9Cmd + Option + Shift + EnterCmd + UCmd + Option + NDebug & Run 11
Ctrl + RCtrl + DCmd + F2F8F7Shift + F8Alt + F9Cmd + F8Cmd + Shift + F8Cmd + Option + RCmd + Option + ECode Quality 9
F2Shift + F2Cmd + Option + Shift + ICmd + Option + Ctrl + ICmd + F1Cmd + Option + ICmd + Option + LCmd + Option + OCtrl + Option + Shift + NSymfony-specific 4
Cmd + Option + DCmd + Option + TCmd + Option + YCmd + Option + MParameter matrix
| Parameter | Effect | Example |
|---|---|---|
Cmd + N | Generate code: constructors, getters/setters, PHPDoc, etc. | Cmd + N |
Cmd + Option + T | Wrap the selected code with if / for / try / PHPDoc | Cmd + Option + T |
Cmd + Option + M | Extract method | Cmd + Option + M |
Cmd + Option + V | Extract variable | Cmd + Option + V |
Cmd + Option + C | Extract constant | Cmd + Option + C |
Cmd + P | View function parameter info | Cmd + P |
Cmd + B | Jump to declaration | Cmd + B |
Cmd + U | Jump to parent class / interface | Cmd + U |
Cmd + Option + B | Jump to implementation | Cmd + Option + B |
Cmd + Option + H | View type hierarchy | Cmd + Option + H |
Cmd + Option + L | Laravel route navigation | Cmd + Option + L |
Cmd + Option + V | Laravel view navigation | Cmd + Option + V |
Cmd + Option + C | Laravel controller navigation | Cmd + Option + C |
Cmd + Option + M | Laravel model navigation | Cmd + Option + M |
Cmd + Option + P | Laravel config file navigation | Cmd + Option + P |
Cmd + Option + R / T | Laravel translation / template navigation | Cmd + Option + R |
Cmd + Shift + F2 | Open the database tool window | Cmd + Shift + F2 |
Cmd + Option + Return | New query console | Cmd + Option + Return |
Cmd + F9 | Run the selected SQL | Cmd + F9 |
Cmd + Option + Shift + Enter | Run all SQL in the console | Cmd + Option + Shift + Enter |
Cmd + U | View table structure in the database tool | Cmd + U |
Cmd + Option + N | New table / view / stored procedure | Cmd + Option + N |
Ctrl + R | Run the current run configuration | Ctrl + R |
Ctrl + D | Start the current configuration in debug mode | Ctrl + D |
Cmd + F2 | Stop the running or debugging process | Cmd + F2 |
F8 / F7 | Step over / step into | F7 |
Shift + F8 | Step out of the current method | Shift + F8 |
Alt + F9 | Run to the cursor line | Alt + F9 |
Cmd + F8 | Toggle breakpoint | Cmd + F8 |
Cmd + Shift + F8 | View all breakpoints | Cmd + Shift + F8 |
Cmd + Option + R | Resume the paused program | Cmd + Option + R |
Cmd + Option + E | Evaluate expression while debugging | Cmd + Option + E |
F2 / Shift + F2 | Jump to the next / previous error | F2 |
Cmd + Option + Shift + I | View the detailed description of an inspection | Cmd + Option + Shift + I |
Cmd + Option + Ctrl + I | Quick documentation | Cmd + Option + Ctrl + I |
Cmd + F1 | Show the current error description | Cmd + F1 |
Cmd + Option + I | Auto-indent the current code block | Cmd + Option + I |
Cmd + Option + L | Format code (configurable for PSR-1/2/12) | Cmd + Option + L |
Cmd + Option + O | Optimize imports, removing unused references | Cmd + Option + O |
Ctrl + Option + Shift + N | View recent changes | Ctrl + Option + Shift + N |
Cmd + Option + D | Symfony route navigation | Cmd + Option + D |
Cmd + Option + T | Symfony service navigation | Cmd + Option + T |
Cmd + Option + Y | Symfony template navigation | Cmd + Option + Y |
Cmd + Option + M | Symfony model navigation | Cmd + Option + M |
Common pitfalls
SymptomThe Laravel route, view, and controller navigation shortcuts do nothing
CauseThe Laravel plugin is not enabled, or the project is not recognized as a Laravel project structure
FixInstall and enable the Laravel plugin, confirm a Laravel entry file exists at the project root, then use these navigation keys
SymptomCannot connect to the database in the database tool, reporting a connection failure
CauseThe data source is not configured, or the configuration does not match the database environment the project actually uses
FixOpen the data source settings and verify host, port, database name, and credentials against the connection info in the project config file
SymptomAfter pressing Ctrl+D the process never finishes and breakpoints do not stop
CauseThe executed code path hits no breakpoint, or the current runtime has no debugger attached
FixUse Cmd+Shift+F8 to confirm the breakpoints exist and are enabled, then verify the debug environment is configured correctly; if needed, use Alt+F9 to run to cursor and confirm step by step
SymptomA large block of code has inconsistent indentation and a dirty diff, noticed only before committing
CauseAuto-formatting was not triggered during editing, and different files keep their own indentation style
FixEnable format-on-save, or run Cmd + Option + L on the changed files before committing and configure it per the project PSR spec
SymptomThe editor gets slower and slower, with noticeable index or code completion delays
CauseLarge directories (vendor, logs, uploads) are included in the index scope
FixMark these directories as Excluded so the IDE only indexes the code actually involved in development
SymptomThe import list is piled with unused classes and inspection keeps warning
CauseUnused references were not cleaned up after refactoring or deleting code
FixRun Cmd + Option + O to optimize imports, then use F2 to clear the remaining inspections one by one
SymptomYou want to find a method implementation but keep jumping to the interface or abstract class
CauseCmd + U goes toward the parent class; finding the actual implementation needs the reverse direction
FixUse Cmd + Option + B to jump to the implementing class, or Cmd + Option + H to view the type hierarchy directly
Troubleshooting
1Confirm whether the current line really has a problem
F2Jumps to the next error location; if it does not jump, the line has no inspection-level error.
2See exactly what an inspection is complaining about
Cmd + Option + Shift + IPops up the detailed description of the inspection and a suggested fix, saving time versus blindly editing code.
3Locate the real implementation along the inheritance chain
Cmd + Option + BJumps to the implementation; if an interface has several implementations, use Cmd + Option + H to see the full hierarchy first.
4Move quickly between framework files
Cmd + Option + LIn a Laravel project it jumps to the route file; in a Symfony project use Cmd + Option + D for the same position.
5Quickly verify a piece of logic
Alt + F9In a debug session it runs to the cursor line and stops, locating the error faster than stepping with F7 repeatedly.
6Unify code style before committing
Cmd + Option + LFormats the current file; after changing the whole project, pair it with Cmd + Option + O to clean up imports.
7Review the scope of changes about to be committed
Ctrl + Option + Shift + NOpens the recent changes view to confirm no debug code or unrelated files are dragged into the commit.
Command Examples
Jump straight to the interface declaration from the method name
// Cursor on getName in $user->getName()
// Press Cmd + B (macOS)
// The view jumps straight to the declaration of UserInterface::getName()
// Then press Cmd + U to jump to the parent class/interface implementationBrowsing a file tree is hopeless in a project with hundreds of classes. Cmd + B to the declaration, Cmd + Option + B to the implementation, and Cmd + Option + H for the type hierarchy cover most navigation needs on their own.
Wrap a bare if/try and generate PHPDoc at the same time
// Select this code:
// $result = $repo->find($id);
// return $result?->name;
// Then press Cmd + Option + T and choose if or try
// If the cursor is on a function name, the same menu can generate a PHPDocSurround-with beats hand-adding braces: it re-indents correctly and never leaves a mismatched closing brace. Applied on a function signature, the same menu also fills the PHPDoc template with parameter and return types.
Output
try {
$result = $repo->find($id);
return $result?->name;
} catch (\Throwable $e) {
}Run only the selected SQL instead of the whole file
// Select a SQL snippet and press Cmd + F9 (run selected SQL)
// Press Cmd + Option + Shift + Enter to run all SQL
// Press Cmd + Shift + F2 to open the database tool windowMigration files usually hold several statements, and running the whole file errors on the already-created tables. Cmd + F9 runs just the selection, and Cmd + U in the database tool window lets you verify columns while writing.
Breakpoint-debug a single suspicious query
// Press Cmd + F8 to set a breakpoint on the $stmt line
// Ctrl + D to start debugging, Alt + F9 to run to cursor
// F7 to step into a method, Shift + F8 to step out, Cmd + Option + E to evaluate an expressionPrint statements rarely reveal the call site that mutated a value. Cmd + Option + E evaluates an arbitrary expression at the breakpoint, and Cmd + Shift + F8 lists every breakpoint so none survive the debugging session.
Navigate from a Laravel route to its controller with Cmd + P
// Cursor on the Route::get line in routes/api.php
// Press Cmd + P to view parameter info, or
// Press Cmd + Option + L to jump to the Laravel route
// Cmd + Option + C jumps to the controller, M to the model, V to the viewThe Laravel shortcuts turn route → controller → model → view into a keystroke each. On Symfony the equivalents are Cmd + Option + D/T/Y/M for route, service, template and model.
Common Pitfalls
- Search everywhere counts node_modules, caches and generated code, so results come back empty or flooded; mark vendor, node_modules and storage as Excluded in Settings → Directories first.
- A leftover breakpoint interrupts unrelated runs later. When execution stops unexpectedly, check Cmd + Shift + F8 for all breakpoints, or use Alt + F9 to run to the cursor past them.
- An UPDATE or DELETE with no WHERE in the database tool window affects the whole table and usually offers no undo; SELECT the affected row count first.
- PHP 7 and PHP 8 differ on dynamic properties and null argument passing, so an IDE index built for a different version than your CLI produces confident but wrong navigation and type hints.
- Ctrl + R and Cmd + Option + L both rewrite working-tree files, so commit before a long debugging session or the reformatting diff will muddy the investigation.
- Cmd + N templates rely on annotations and naming; without PHPDoc the generated accessors can be typed as mixed and need manual type declarations afterwards.
Tips
- PhpStorm is built on the IntelliJ platform; most shortcuts match WebStorm and IDEA.
- Cmd+N generates code: choose constructor, getter/setter, PHPDoc, etc. - faster than writing by hand.
- The Laravel Plugin provides quick jumps for routes, views, and controllers.
- Database tools connect directly to MySQL and PostgreSQL without switching to Navicat.
- After configuring Xdebug, Ctrl+D starts debugging; F7/F8 step through PHP code.
- Cmd+Option+L reformats code; you can configure PSR-1/PSR-2/PSR-12 in settings.
FAQ
Cmd + Option + L and M mean both formatting/refactoring and framework jumps — what do I do about the clash?
The clash is real: Cmd + Option + L formats code in the code-quality group (configurable to PSR-1/PSR-12) yet is route/template navigation in the Laravel and Symfony groups; Cmd + Option + M is Extract Method but also the Laravel/Symfony model jump; Cmd + Option + R is Resume but also the Laravel translation jump. Fix it in Settings → Keymap: search the chord, Clear the one you do not want, then Add the framework action to another chord. Do not memorise two schemes — the framework-agnostic set is short: Cmd + N, Cmd + P, Cmd + B, Cmd + U and Cmd + Option + B.
Writing constructors, accessors and PHPDoc by hand is slow — how do I generate them?
Inside the class body or on a method press Cmd + N to open the generate menu, which lists constructors, getters/setters, PHPDoc, equals/hashCode and more — pick one and the skeleton appears. Two follow-up steps usually finish the job: Cmd + Option + T wraps the code (if, for, try, PHPDoc), turning the statement under the cursor into a control structure or attaching a doc block; then Cmd + Option + I auto-indents, Cmd + Option + L formats to the project PSR rules, and Cmd + Option + O optimises imports. Before committing, F2 jumps to the next error and flushes out any missed import or syntax problem.
While debugging, when do I press F7, F8, Shift + F8 and Alt + F9?
Think enter, step over, step out, run-to-here. F7 steps into the function called on the current line. F8 steps over it, executing the line without descending. Shift + F8 steps out, returning from the current function to its caller. Alt + F9 runs to the cursor, effectively dropping a breakpoint there and racing ahead — far better than mashing F8 through a long loop. Supporting actions: Cmd + F8 toggles a breakpoint, Cmd + Shift + F8 lists all of them, and Cmd + Option + E evaluates an expression so you can inspect a field or call a function while paused. With Xdebug configured, launch with Ctrl + D rather than Ctrl + R.
How do Cmd + B, Cmd + U, Cmd + Option + B and Cmd + Option + H differ as navigation tools?
They are four levels of depth for reading an unfamiliar codebase. Cmd + B jumps to the declaration of the current symbol and is the one you will press most. Cmd + U goes to the parent class or interface, which is how you walk an inheritance chain. Cmd + Option + B jumps to the implementation of an interface, answering "who actually fulfils this abstract method?". Cmd + Option + H opens the whole type hierarchy, laying out supertypes and subtypes at once. When you do not want to move at all, Cmd + P shows parameter information for the current function (names, types, defaults) and Cmd + Option + Ctrl + I pops quick documentation. In the SQL console, Cmd + U is instead View table structure.
Why stay inside the IDE database tool instead of opening Navicat?
PhpStorm ships a database tool that connects to MySQL and PostgreSQL directly, so you stop hopping between the editor and a separate client to change connection strings. Everything runs on shortcuts: Cmd + Shift + F2 opens the tool window, Cmd + Option + Return creates a new query console, Cmd + F9 runs only the selected SQL (fastest when debugging one statement), Cmd + Option + Shift + Enter runs the whole script, Cmd + U views the table structure, and Cmd + Option + N creates a table, view or stored procedure. While working on Laravel or Symfony the payoff is obvious: code and result sets sit side by side, so you edit and re-verify without leaving the project.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us