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.

Dev Tools·47 commands·Last updated 2026-07-21

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 + N
Generate code (constructor, getter/setter, PHPDoc)
Cmd + Option + T
Surround with (if/for/try/PHPDoc)
Cmd + Option + M
Extract method
Cmd + Option + V
Extract variable
Cmd + Option + C
Extract constant
Cmd + P
Parameter info (view function params)
Cmd + B
Go to declaration
Cmd + U
Go to superclass/interface
Cmd + Option + B
Go to implementation
Cmd + Option + H
View type hierarchy

Laravel-specific 7

Cmd + Option + L
Laravel route jump
Cmd + Option + V
Laravel view jump
Cmd + Option + C
Laravel controller jump
Cmd + Option + M
Laravel model jump
Cmd + Option + P
Laravel config jump
Cmd + Option + R
Laravel translation jump
Cmd + Option + T
Laravel template jump

Database Tools 6

Cmd + Shift + F2
Open Database tool window
Cmd + Option + Return
New query console
Cmd + F9
Execute selected SQL
Cmd + Option + Shift + Enter
Execute all SQL
Cmd + U
View table structure
Cmd + Option + N
New table/view/stored procedure

Debug & Run 11

Ctrl + R
Run current configuration
Ctrl + D
Debug current configuration
Cmd + F2
Stop
F8
Step over
F7
Step into
Shift + F8
Step out
Alt + F9
Run to cursor
Cmd + F8
Toggle breakpoint
Cmd + Shift + F8
View all breakpoints
Cmd + Option + R
Resume program
Cmd + Option + E
Evaluate expression

Code Quality 9

F2
Next error
Shift + F2
Previous error
Cmd + Option + Shift + I
View inspection description
Cmd + Option + Ctrl + I
Quick documentation
Cmd + F1
Show error description
Cmd + Option + I
Auto-indent
Cmd + Option + L
Reformat code
Cmd + Option + O
Optimize imports
Ctrl + Option + Shift + N
Recent changes

Symfony-specific 4

Cmd + Option + D
Symfony route jump
Cmd + Option + T
Symfony service jump
Cmd + Option + Y
Symfony template jump
Cmd + Option + M
Symfony model jump

Parameter matrix

ParameterEffectExample
Cmd + NGenerate code: constructors, getters/setters, PHPDoc, etc.Cmd + N
Cmd + Option + TWrap the selected code with if / for / try / PHPDocCmd + Option + T
Cmd + Option + MExtract methodCmd + Option + M
Cmd + Option + VExtract variableCmd + Option + V
Cmd + Option + CExtract constantCmd + Option + C
Cmd + PView function parameter infoCmd + P
Cmd + BJump to declarationCmd + B
Cmd + UJump to parent class / interfaceCmd + U
Cmd + Option + BJump to implementationCmd + Option + B
Cmd + Option + HView type hierarchyCmd + Option + H
Cmd + Option + LLaravel route navigationCmd + Option + L
Cmd + Option + VLaravel view navigationCmd + Option + V
Cmd + Option + CLaravel controller navigationCmd + Option + C
Cmd + Option + MLaravel model navigationCmd + Option + M
Cmd + Option + PLaravel config file navigationCmd + Option + P
Cmd + Option + R / TLaravel translation / template navigationCmd + Option + R
Cmd + Shift + F2Open the database tool windowCmd + Shift + F2
Cmd + Option + ReturnNew query consoleCmd + Option + Return
Cmd + F9Run the selected SQLCmd + F9
Cmd + Option + Shift + EnterRun all SQL in the consoleCmd + Option + Shift + Enter
Cmd + UView table structure in the database toolCmd + U
Cmd + Option + NNew table / view / stored procedureCmd + Option + N
Ctrl + RRun the current run configurationCtrl + R
Ctrl + DStart the current configuration in debug modeCtrl + D
Cmd + F2Stop the running or debugging processCmd + F2
F8 / F7Step over / step intoF7
Shift + F8Step out of the current methodShift + F8
Alt + F9Run to the cursor lineAlt + F9
Cmd + F8Toggle breakpointCmd + F8
Cmd + Shift + F8View all breakpointsCmd + Shift + F8
Cmd + Option + RResume the paused programCmd + Option + R
Cmd + Option + EEvaluate expression while debuggingCmd + Option + E
F2 / Shift + F2Jump to the next / previous errorF2
Cmd + Option + Shift + IView the detailed description of an inspectionCmd + Option + Shift + I
Cmd + Option + Ctrl + IQuick documentationCmd + Option + Ctrl + I
Cmd + F1Show the current error descriptionCmd + F1
Cmd + Option + IAuto-indent the current code blockCmd + Option + I
Cmd + Option + LFormat code (configurable for PSR-1/2/12)Cmd + Option + L
Cmd + Option + OOptimize imports, removing unused referencesCmd + Option + O
Ctrl + Option + Shift + NView recent changesCtrl + Option + Shift + N
Cmd + Option + DSymfony route navigationCmd + Option + D
Cmd + Option + TSymfony service navigationCmd + Option + T
Cmd + Option + YSymfony template navigationCmd + Option + Y
Cmd + Option + MSymfony model navigationCmd + 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

  1. 1Confirm whether the current line really has a problem

    F2

    Jumps to the next error location; if it does not jump, the line has no inspection-level error.

  2. 2See exactly what an inspection is complaining about

    Cmd + Option + Shift + I

    Pops up the detailed description of the inspection and a suggested fix, saving time versus blindly editing code.

  3. 3Locate the real implementation along the inheritance chain

    Cmd + Option + B

    Jumps to the implementation; if an interface has several implementations, use Cmd + Option + H to see the full hierarchy first.

  4. 4Move quickly between framework files

    Cmd + Option + L

    In a Laravel project it jumps to the route file; in a Symfony project use Cmd + Option + D for the same position.

  5. 5Quickly verify a piece of logic

    Alt + F9

    In a debug session it runs to the cursor line and stops, locating the error faster than stepping with F7 repeatedly.

  6. 6Unify code style before committing

    Cmd + Option + L

    Formats the current file; after changing the whole project, pair it with Cmd + Option + O to clean up imports.

  7. 7Review the scope of changes about to be committed

    Ctrl + Option + Shift + N

    Opens 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 implementation

Browsing 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 PHPDoc

Surround-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 window

Migration 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 expression

Print 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 view

The 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