PHPX Tag SupportPHPX Tag Support is a comprehensive Visual Studio Code extension designed to enhance your Prisma PHP development workflow. It provides intelligent tag support, auto-completion, diagnostics, and advanced integrations for PHPX components, Prisma operations, and JavaScript/TypeScript-style templating. 🚀 Key Features🏷️ Component Management
📝 Code Generation
🎯 Intelligent Completion
🗺️ Route ManagementIntelligent Route Completion
Route Discovery
Smart Link Validation
Route Navigation
📌 Route Example
PHP Redirect Support
PHP Redirect Calls
🔍 Navigation & Information
🛡️ Advanced DiagnosticsXML & HTML Validation
Import & Usage Validation
JavaScript Expression Validation
⚙️ PPHP Integration
🎯 Enumerated Props – strict list vs. list +
|
Annotation style | Extension behaviour | When to use it |
---|---|---|
/** @property string $color = success\|warning\|error */ |
Strict enum – attribute must match one of the tokens | For finite sets like variants |
/** @property string $color = success\|warning\|error\|* */ |
Enum + wildcard – suggests presets but allows custom | For extensible values like CSS colors |
📌 Component Example
class Badge extends PHPX
{
/** @property string $color = success|warning|error|* */
public string $color = 'success';
}
🗃️ Prisma Integration
- Schema Validation
- CRUD Support: create, read, update, delete, upsert
- Advanced Queries: groupBy, aggregate
- Field Completion: model fields & relations
🎨 Syntax Highlighting
- Mustache Expressions (
{{ }}
) - Template Literals (
${}
) - JS Native Methods
- String/Number Literals
- Curly Braces Highlighting
📁 File Management
- Real-time Updates on File Changes
- Project Integration with
class-log.json
- Monitors file changes for auto-refresh
📋 Complete Feature List
Feature Category | Capabilities |
---|---|
Auto-Import | Ctrl+., grouped imports, alias support |
Code Generation | phpxclass , namespace detection |
Component Support | Tag, props, attributes |
Route Management | Autocomplete, validation, refresh |
Navigation | Go to definition, peek, Ctrl+Click |
Diagnostics | Imports, XML/JS validation |
Mustache Templating | Variable, method, and expression validation |
PPHP Integration | Methods, store, searchParams |
Prisma Support | Schema, CRUD, queries |
Syntax Highlighting | Expressions, strings, JS methods |
Event Handlers | Completion, lookup, hints |
File Watching | Refresh, cache, updates |
🛠️ Installation
From the Marketplace
Search for PHPX Tag Support
in the VS Code Marketplace and click Install.
From VSIX File
code --install-extension phpx-tag-support-0.0.1.vsix
🚀 Usage Examples
Creating a New Component
- Type
phpxclass
in a new file - Generates full component scaffold
Auto-Importing Components
- Type
<ComponentName
- Press
Ctrl+.
to auto-import
Using Mustache Expressions
<div class="user-info">
{{ user.name.substring(0, 10) }} {{ `Hello ${user.name}!` }} {{
store.getValue('theme') }}
</div>
Event Handler Completion
<Button onClick="handleClick" onSubmit="validateForm">
Click me
</Button>
Route Management
<nav class="menu">
<a href="/">Home</a>
<!-- ✅ -->
<a href="/dashboard">Dashboard</a>
<!-- ✅ -->
<a href="/users">Users</a>
<!-- ✅ -->
<a href="/invalid">Invalid</a>
<!-- ❌ -->
</nav>
<a href="/orm/group-by">Group By</a>
<!-- Ctrl+Click -->
⚙️ Configuration
{
"editor.gotoLocation.single": "peek",
"editor.gotoLocation.multiple": "peek",
"phpx-tag-support.sourceRoot": "src"
}
📁 Project Structure
Ensure your Prisma PHP project includes:
prisma-php.json
– project identifiersettings/class-log.json
– component definitionssettings/files-list.json
– route definitionssettings/prisma-schema.json
– Prisma integration.pphp/phpx-mustache.d.ts
– TypeScript for Mustache
🎯 Commands
Command | Shortcut | Description |
---|---|---|
Add Import | Ctrl+. | Auto-import missing components |
Peek Tag Definition | F12 | Show tag definition inline |
Go to Definition | Ctrl+Click | Navigate to source file |
Go to Route File | Ctrl+Click | Navigate to route's index.php |
Refresh Routes | Ctrl+Shift+P | Manually refresh route cache |
Show All Routes | Ctrl+Shift+P | Display all available routes |
🤝 Contributing
Contributions are welcome! This extension supports a wide range of features for modern PHP development with PHPX.
Development Setup
git clone https://github.com/your-repo/phpx-tag-support.git
cd phpx-tag-support
npm install
- Open in VS Code
- Press
F5
to launch the extension development host
📄 License
Licensed under the MIT License. See the LICENSE file for details.
🔥 Pro Tip: This extension works best in Prisma PHP projects with properly configured class-log.json
, files-list.json
, and TypeScript definitions for maximum IntelliSense support!