PHP Sense

Professional PHP language server with intelligent code completion, analysis, and IDE features.
Bring code intelligence to PHP development with a modern, performant language server built for VS Code.
✨ Features
🎁 Free Features
Code Intelligence
- ✅ Code Completion - Intelligent autocomplete for PHP keywords, classes, functions, methods, and variables with context awareness
- ✅ Go to Definition (F12) - Jump to class, function, interface, trait, and method definitions with full namespace resolution
- ✅ Find References (Ctrl+Shift+H) - Locate all usages of symbols across your entire project
- ✅ Hover Information - View detailed symbol information on hover including type, namespace, and location
Navigation & Search
- ✅ Document Outline (Ctrl+O) - Browse all symbols in the current file with visual hierarchy
- ✅ Workspace Symbol Search (Ctrl+T) - Search for classes, functions, and symbols across your entire workspace
- ✅ Symbol Navigation - Quick jump to any symbol definition
Code Analysis
- ✅ Basic Diagnostics - Detect unclosed braces, parentheses, and common syntax errors
- ✅ Namespace Detection - Automatic PHP namespace tracking and resolution
- ✅ Class/Interface/Trait Detection - Full support for OOP constructs
- ✅ Method vs Function Detection - Proper scope awareness for accurate suggestions
- ✅ Smart Caching - Per-file symbol caching for blazing-fast lookup times
- ✅ Incremental Parsing - Only re-parse changed files for optimal performance
- ✅ Workspace Indexing - Background indexing of your entire PHP project
🔒 Premium Features (Coming Soon)
- 🔓 Advanced symbol renaming with safe refactoring
- 🔓 Code folding for functions, classes, and comments
- 🔓 Find implementations and type definitions
- 🔓 Code actions and quick fixes
- 🔓 Type hierarchy visualization
- 🔓 Document links and cross-file navigation
- 🔓 Advanced type inference
- 🔓 Comprehensive diagnostics with auto-fixes
- 🔓 Custom code actions
- 🔓 Priority support
🚀 Quick Start
Installation
Open VS Code Extensions
- Press
Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac)
- Or go to View → Extensions
Search for "PHP Sense"
- Look for the official extension by PHP Sense Contributors
Click Install
- Wait for installation to complete
- Reload VS Code if prompted
First Steps
Open a PHP project
code /path/to/your/php/project
Start coding
- Open any
.php or .phtml file
- PHP Sense activates automatically
Use IDE features
- Type to see code completion
- Hover over symbols for information
- Press F12 to go to definition
- Use Ctrl+T to search symbols
📖 Usage Guide
Code Completion
Automatic Trigger
- Start typing:
new, $, ->, ::
- Completion menu appears with context-aware suggestions
- Press
Tab or Enter to accept
- Press
Escape to dismiss
Manual Trigger
- Press
Ctrl+Space to open completion menu anytime
Completion Features
- Type information and documentation
- Parameter hints for functions and methods
- Support for classes, interfaces, traits, functions, and variables
- Namespace-aware suggestions
Go to Definition (F12)
Navigate to symbol definitions instantly:
class User {
public function getName() {
return $this->name;
}
}
$user = new User(); // F12 on User → jumps to class definition
$user->getName(); // F12 on getName → jumps to method definition
Keyboard Shortcuts
- F12 or Ctrl+Click (Cmd+Click on Mac)
- Go back: Alt+Left Arrow (Windows/Linux) or Cmd+Left Arrow (Mac)
Find References (Ctrl+Shift+H)
Find all usages of a symbol:
$user = new User(); // Reference 1
echo $user->getName(); // Reference 2
$user->setName('John'); // Reference 3
// All shown with Ctrl+Shift+H
Document Symbols (Ctrl+O)
View all symbols in current file:
- Classes and interfaces
- Functions and methods
- Properties and constants
- Organized by type and namespace
Workspace Symbol Search (Ctrl+T)
Search for symbols across entire project:
- Query by name:
UserRepository
- Fuzzy matching:
UR matches UserRepository
- Type filtering:
class:User, function:create
Hover over any symbol to see:
- Symbol type (class, function, method, property)
- Namespace and location
- Fully qualified name (FQN)
- Documentation (if available)
Example:
class Calculator {
public function add($a, $b) { // Hover shows: method add in class Calculator
return $a + $b;
}
}
⚙️ Configuration
Quick Settings Access
- Open settings:
Ctrl+, (Windows/Linux) or Cmd+, (Mac)
- Search:
php sense
- Configure your preferences
Available Settings
Core Features
| Setting |
Default |
Description |
phpSense.enable |
true |
Enable/disable PHP Sense |
phpSense.parser.enable |
true |
Enable code parsing for symbol extraction |
phpSense.completion.enable |
true |
Enable code completion |
phpSense.hover.enable |
true |
Enable hover information |
phpSense.definition.enable |
true |
Enable go to definition (F12) |
phpSense.references.enable |
true |
Enable find references |
phpSense.symbols.enable |
true |
Enable symbol features |
Completion Settings
| Setting |
Default |
Description |
phpSense.completion.autoTrigger |
true |
Auto-trigger completion suggestions |
phpSense.completion.triggerCharacters |
$>:\\space |
Characters that trigger completion |
Symbol Settings
| Setting |
Default |
Description |
phpSense.symbols.documentSymbols |
true |
Enable document outline (Ctrl+O) |
phpSense.symbols.workspaceSymbols |
true |
Enable workspace search (Ctrl+T) |
| Setting |
Default |
Description |
phpSense.formatting.enable |
false |
Enable code formatting |
phpSense.formatting.standard |
PSR-12 |
Coding standard: PSR-12, PSR-2, ZEND, SYMFONY |
Diagnostics Settings
| Setting |
Default |
Description |
phpSense.diagnostics.enable |
true |
Enable error checking |
phpSense.diagnostics.showWarnings |
true |
Show warning level issues |
phpSense.diagnostics.checkSyntax |
true |
Check PHP syntax |
| Setting |
Default |
Description |
phpSense.cache.enable |
true |
Enable symbol caching |
phpSense.cache.size |
100 |
Max cached files (10-1000) |
phpSense.maxFilesToAnalyze |
1000 |
Max PHP files to analyze |
phpSense.excludePatterns |
node_modules, vendor, .git, dist, build |
Patterns to ignore |
phpSense.includePatterns |
**/*.php, **/*.phtml |
Patterns to include |
Logging Settings
| Setting |
Default |
Description |
phpSense.logging.level |
info |
Logging level: off, error, warning, info, debug |
phpSense.logging.verbose |
false |
Enable verbose output |
Example Configuration
.vscode/settings.json
{
"phpSense.completion.enable": true,
"phpSense.completion.autoTrigger": true,
"phpSense.formatting.standard": "PSR-12",
"phpSense.cache.size": 200,
"phpSense.maxFilesToAnalyze": 2000,
"phpSense.excludePatterns": [
"**/node_modules/**",
"**/vendor/**",
"**/.git/**",
"**/dist/**",
"**/temp/**",
"**/*.min.php"
],
"phpSense.logging.level": "warning"
}
🎯 Keyboard Shortcuts
| Action |
Windows/Linux |
Mac |
| Go to Definition |
F12 |
F12 |
| Go to Definition |
Ctrl+Click |
Cmd+Click |
| Find References |
Ctrl+Shift+H |
Cmd+Shift+H |
| Show Hover |
Hover over symbol |
Hover over symbol |
| Document Outline |
Ctrl+O |
Cmd+O |
| Workspace Search |
Ctrl+T |
Cmd+T |
| Code Completion |
Ctrl+Space |
Cmd+Space |
| Show Command Palette |
Ctrl+Shift+P |
Cmd+Shift+P |
🔍 Architecture
Server Components
- Parser - High-performance PHP code parser with namespace tracking
- Analyzer - Symbol extraction and intelligent caching system
- LSP Handlers - Language Server Protocol implementation
- Type System - Full TypeScript type safety throughout
Key Features
- Per-file symbol caching for O(1) lookups
- Context-aware completion suggestions
- Full qualified name (FQN) resolution
- Namespace and class context tracking
- Incremental document updates
- Workspace-wide symbol indexing
🐛 Troubleshooting
Extension Not Appearing
Check Extension Status
- Open Command Palette (Ctrl+Shift+P)
- Type "Extensions: Show" and select
- Search "PHP Sense"
Reload VS Code
- Close VS Code completely
- Reopen the project
- Let extension activate (look for "PHP Sense" in Output panel)
Features Not Working
Check Output Panel
- View → Output
- Select "PHP Sense" from dropdown
- Look for error messages
Enable Debug Logging
- Settings → Search "phpSense.logging"
- Set level to "debug"
- Check Output panel for detailed logs
Reset Cache
- Run command: "PHP Sense: Clear Cache"
- Reload VS Code
Check File Limits
- Settings →
phpSense.maxFilesToAnalyze
- Reduce if analyzing too many files
Optimize Exclude Patterns
- Settings →
phpSense.excludePatterns
- Add heavy directories (node_modules, vendor, dist)
Disable Cache (debugging only)
- Settings →
phpSense.cache.enable → false
📝 Common Tasks
Disable PHP Sense for a Project
Add to .vscode/settings.json:
{
"phpSense.enable": false
}
Use Different Coding Standard
Add to .vscode/settings.json:
{
"phpSense.formatting.standard": "PSR-2"
}
Options: PSR-12, PSR-2, ZEND, SYMFONY
Limit Analysis to Specific Files
Add to .vscode/settings.json:
{
"phpSense.includePatterns": ["src/**/*.php"],
"phpSense.excludePatterns": ["src/legacy/**"]
}
Enable Verbose Logging
Add to .vscode/settings.json:
{
"phpSense.logging.level": "debug",
"phpSense.logging.verbose": true
}
🤝 Contributing
We welcome contributions! Here's how to help:
- Report Bugs - Create an issue on GitHub
- Suggest Features - Share ideas for improvements
- Submit PRs - Help fix bugs or add features
- Improve Docs - Help others understand the extension
📄 License
MIT License - See LICENSE for details (client: MIT; server: PHP Sense Licence).
🔗 Links
💡 Tips & Tricks
Quick Keyboard Shortcuts
Navigate Code Faster
- Use Ctrl+T (Cmd+T) to search any symbol
- Use Ctrl+O (Cmd+O) for quick file navigation
Multi-file Navigation
- Ctrl+Click (Cmd+Click) on symbols to go to definition
- Alt+Left to go back through history
Smart Completion
- Type partial names for fuzzy matching
- Use arrow keys to navigate suggestions
- Press Escape to dismiss
Project Organization
For best performance:
- Keep
vendor/ directory in .gitignore
- Use exclude patterns for build outputs
- Organize code with clear namespaces
🎉 Getting Help
- Documentation - Check out guides in the project
- Output Panel - View logs and error messages
- GitHub Issues - Ask questions or report problems
- Settings Panel - Configure behavior to your needs
Made with ❤️ for PHP developers
Start coding smarter with PHP Sense today! 🚀