FlightPHP Skill
This skill helps users work with FlightPHP - a fast, simple, and extensible PHP micro-framework.
When to Use This Skill
Use this skill whenever the user:
- Asks about FlightPHP features or how to do something in Flight
- Needs code examples for routing, middleware, requests, responses, or plugins
- Is debugging a FlightPHP application
- Mentions Flight framework, PHP API development, or any FlightPHP-specific topics
Context7 Integration
FlightPHP has excellent documentation available via Context7. Always use Context7 to fetch relevant, up-to-date information.
Library ID: /websites/flightphp_en_v3
How to Query Context7
First, resolve the library to get the Context7-compatible ID:
- Use
mcp__plugin_context7_context7__resolve-library-id with libraryName: "flightphp"
Then query the documentation:
- Use
mcp__plugin_context7_context7__query-docs with the library ID and a specific query about the topic
Example queries:
- "How to set up routing in FlightPHP with route parameters"
- "FlightPHP middleware implementation example"
- "FlightPHP request and response handling"
- "FlightPHP configuration and dependency injection"
- "FlightPHP plugins - JWT, sessions, caching"
How This Skill Works
1. Answering Questions
When the user asks a question about FlightPHP:
- Use Context7 to fetch relevant documentation
- Read the documentation to understand the topic
- Provide a clear, accurate answer with code examples when appropriate
- Reference the official docs for further reading
2. Generating Code Examples
When the user needs code:
- Identify what they're trying to accomplish (routing, middleware, DB, etc.)
- Use Context7 to get current best practices
- Provide complete, working code snippets
- Explain the code briefly
3. Debugging FlightPHP Issues
When helping debug:
- Ask clarifying questions about the error/issue
- Use Context7 to find relevant documentation
- Provide diagnostic steps and solutions
- Suggest common pitfalls to check
Core Topics Covered by FlightPHP
- Routing: Basic routes, route parameters, groups, named routes
- Requests: Input data, headers, uploaded files
- Responses: JSON, HTML, redirects, cookies
- Middleware: Before/after request processing
- Configuration: Framework settings, environment config
- Dependency Injection: Container and service registration
- Events: Event system for extensibility
- Database: PDO helpers, Active Record, Easy Query plugin
- Templates: View rendering with template engines
- Security: CSRF protection, input filtering
- Plugins: JWT auth, sessions, caching, Tracy debugging
4. Migrating to FlightPHP
When helping migrate an existing PHP project to FlightPHP:
Step 1: Analyze Existing Structure (Code Review)
Before generating any FlightPHP code, you MUST understand the user's existing codebase:
Explore the project structure:
- List files and directories to understand organization
- Look for common patterns: controllers, models, views folders
- Identify the entry point (index.php, public/index.php, etc.)
Review key files:
- Read controller files to understand routing patterns
- Read model files to understand database access patterns
- Read base/parent classes if inheritance is used
- Look at configuration files
Ask the user clarifying questions:
- "Can you show me a typical controller file?"
- "How do you handle database queries?"
- "What does your routing look like?"
- "How are views rendered?"
Step 2: Map Patterns to FlightPHP
Based on the code review, map existing patterns to FlightPHP:
| Original Pattern |
FlightPHP Equivalent |
| Custom router |
Flight::route() with parameters |
| BaseController class |
Plain PHP class or Flight's controller pattern |
| Model base class |
SimplePdo, PdoWrapper, or EasyQuery plugin |
| View files |
Flight::render() or Latte plugin |
| Custom auth |
JWT plugin or middleware |
| Session handling |
Session plugin |
| Input filtering |
Flight's filtering functions |
Step 3: Generate Migration Code
Create a mapping document showing:
- Original file → FlightPHP equivalent
- Key changes needed (syntax, structure)
Generate the FlightPHP version:
- Use Context7 to find best practices
- Convert routing patterns
- Convert controllers to FlightPHP style
- Set up database connection
Test the migration:
- Ensure routes work correctly
- Verify database queries function
- Check middleware execution order
Migration Code Generation Examples
Custom Controller → FlightPHP:
// BEFORE (custom MVC)
class UserController extends BaseController {
public function show($id) {
$user = $this->model->find($id);
$this->view('user/profile', ['user' => $user]);
}
}
// AFTER (FlightPHP)
Flight::route('/user/@id', function(string $id) {
$user = User::find($id);
Flight::render('user/profile', ['user' => $user]);
});
Custom Model → FlightPHP with EasyQuery:
// BEFORE (custom MVC)
class User extends Model {
public function find($id) {
return $this->db->query("SELECT * FROM users WHERE id = ?", [$id])->fetch();
}
}
// AFTER (FlightPHP with EasyQuery)
use flight\awesome\Querying\Model;
class User extends Model {
protected static string $table = 'users';
}
// Usage: User::find($id)
Output Guidelines
- Always be helpful and concise
- Provide working code examples when possible
- Use modern PHP (PHP 8+) syntax
- Reference official FlightPHP documentation when available
- If unsure about something, say so and suggest checking the docs
1---2name: flightphp3description: Helps with FlightPHP questions, code examples, debugging, and migrating existing PHP projects to FlightPHP. Use when working with FlightPHP framework, routing, middleware, requests, responses, plugins, building PHP APIs, or converting from other PHP frameworks like CodeIgniter or custom MVC.4---56# FlightPHP Skill78This skill helps users work with FlightPHP - a fast, simple, and extensible PHP micro-framework.910## When to Use This Skill1112Use this skill whenever the user:13- Asks about FlightPHP features or how to do something in Flight14- Needs code examples for routing, middleware, requests, responses, or plugins15- Is debugging a FlightPHP application16- Mentions Flight framework, PHP API development, or any FlightPHP-specific topics1718## Context7 Integration1920FlightPHP has excellent documentation available via Context7. Always use Context7 to fetch relevant, up-to-date information.2122**Library ID:** `/websites/flightphp_en_v3`2324### How to Query Context725261. First, resolve the library to get the Context7-compatible ID:27 - Use `mcp__plugin_context7_context7__resolve-library-id` with `libraryName: "flightphp"`28292. Then query the documentation:30 - Use `mcp__plugin_context7_context7__query-docs` with the library ID and a specific query about the topic3132**Example queries:**33- "How to set up routing in FlightPHP with route parameters"34- "FlightPHP middleware implementation example"35- "FlightPHP request and response handling"36- "FlightPHP configuration and dependency injection"37- "FlightPHP plugins - JWT, sessions, caching"3839## How This Skill Works4041### 1. Answering Questions4243When the user asks a question about FlightPHP:44451. Use Context7 to fetch relevant documentation462. Read the documentation to understand the topic473. Provide a clear, accurate answer with code examples when appropriate484. Reference the official docs for further reading4950### 2. Generating Code Examples5152When the user needs code:53541. Identify what they're trying to accomplish (routing, middleware, DB, etc.)552. Use Context7 to get current best practices563. Provide complete, working code snippets574. Explain the code briefly5859### 3. Debugging FlightPHP Issues6061When helping debug:62631. Ask clarifying questions about the error/issue642. Use Context7 to find relevant documentation653. Provide diagnostic steps and solutions664. Suggest common pitfalls to check6768## Core Topics Covered by FlightPHP6970- **Routing**: Basic routes, route parameters, groups, named routes71- **Requests**: Input data, headers, uploaded files72- **Responses**: JSON, HTML, redirects, cookies73- **Middleware**: Before/after request processing74- **Configuration**: Framework settings, environment config75- **Dependency Injection**: Container and service registration76- **Events**: Event system for extensibility77- **Database**: PDO helpers, Active Record, Easy Query plugin78- **Templates**: View rendering with template engines79- **Security**: CSRF protection, input filtering80- **Plugins**: JWT auth, sessions, caching, Tracy debugging8182### 4. Migrating to FlightPHP8384When helping migrate an existing PHP project to FlightPHP:8586#### Step 1: Analyze Existing Structure (Code Review)8788Before generating any FlightPHP code, you MUST understand the user's existing codebase:89901. **Explore the project structure**:91 - List files and directories to understand organization92 - Look for common patterns: controllers, models, views folders93 - Identify the entry point (index.php, public/index.php, etc.)94952. **Review key files**:96 - Read controller files to understand routing patterns97 - Read model files to understand database access patterns98 - Read base/parent classes if inheritance is used99 - Look at configuration files1001013. **Ask the user clarifying questions**:102 - "Can you show me a typical controller file?"103 - "How do you handle database queries?"104 - "What does your routing look like?"105 - "How are views rendered?"106107#### Step 2: Map Patterns to FlightPHP108109Based on the code review, map existing patterns to FlightPHP:110111| Original Pattern | FlightPHP Equivalent |112|-----------------|---------------------|113| Custom router | `Flight::route()` with parameters |114| BaseController class | Plain PHP class or Flight's controller pattern |115| Model base class | `SimplePdo`, `PdoWrapper`, or `EasyQuery` plugin |116| View files | `Flight::render()` or Latte plugin |117| Custom auth | JWT plugin or middleware |118| Session handling | Session plugin |119| Input filtering | Flight's filtering functions |120121#### Step 3: Generate Migration Code1221231. Create a **mapping document** showing:124 - Original file → FlightPHP equivalent125 - Key changes needed (syntax, structure)1261272. Generate the FlightPHP version:128 - Use Context7 to find best practices129 - Convert routing patterns130 - Convert controllers to FlightPHP style131 - Set up database connection1321333. Test the migration:134 - Ensure routes work correctly135 - Verify database queries function136 - Check middleware execution order137138### Migration Code Generation Examples139140**Custom Controller → FlightPHP:**141```php142// BEFORE (custom MVC)143class UserController extends BaseController {144 public function show($id) {145 $user = $this->model->find($id);146 $this->view('user/profile', ['user' => $user]);147 }148}149150// AFTER (FlightPHP)151Flight::route('/user/@id', function(string $id) {152 $user = User::find($id);153 Flight::render('user/profile', ['user' => $user]);154});155```156157**Custom Model → FlightPHP with EasyQuery:**158```php159// BEFORE (custom MVC)160class User extends Model {161 public function find($id) {162 return $this->db->query("SELECT * FROM users WHERE id = ?", [$id])->fetch();163 }164}165166// AFTER (FlightPHP with EasyQuery)167use flight\awesome\Querying\Model;168169class User extends Model {170 protected static string $table = 'users';171}172173// Usage: User::find($id)174```175176## Output Guidelines177178- Always be helpful and concise179- Provide working code examples when possible180- Use modern PHP (PHP 8+) syntax181- Reference official FlightPHP documentation when available182- If unsure about something, say so and suggest checking the docs