### Plugin Installation and Verification Source: https://context7.com/pluginagentmarketplace/custom-plugin-php/llms.txt Instructions for installing the PHP Assistant plugin via the marketplace or local repository. Includes verification steps to ensure all specialized agents are correctly loaded. ```bash # Marketplace Installation /plugin marketplace add pluginagentmarketplace/custom-plugin-php /plugin install php-assistant@pluginagentmarketplace-php # Local Installation git clone https://github.com/pluginagentmarketplace/custom-plugin-php.git cd custom-plugin-php /plugin load . # Verify Installation # After restart, you should see these agents: # php-assistant:01-php-fundamentals # php-assistant:02-php-laravel # php-assistant:03-php-symfony # php-assistant:04-php-wordpress # php-assistant:05-php-database # php-assistant:06-php-testing # php-assistant:07-php-api ``` -------------------------------- ### Skill Usage Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-symfony/SKILL.md An example demonstrating how to invoke a 'php-symfony' skill with specified topic and level. This format is typically used in a system that manages or executes skills based on defined parameters. ```text Skill("php-symfony", {topic: "messenger", level: "advanced"}) ``` -------------------------------- ### Install Php Assistant Plugin Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/README.md Provides instructions for installing the plugin via the Claude Code marketplace or by loading it locally from a cloned repository. Requires Claude Code CLI v2.0.27 or higher. ```bash # Marketplace Installation /plugin marketplace add pluginagentmarketplace/custom-plugin-php /plugin install php-assistant@pluginagentmarketplace-php ``` ```bash # Local Installation git clone https://github.com/pluginagentmarketplace/custom-plugin-php.git cd custom-plugin-php /plugin load . ``` -------------------------------- ### Usage Example (Skill Function) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-api/SKILL.md An example of how to invoke a 'Skill' function, likely for integrating with a system that manages skills or plugins. It specifies the skill name 'php-api' and provides topic and level parameters. ```javascript Skill("php-api", {topic: "authentication", level: "intermediate"}) ``` -------------------------------- ### Task Invocation with Prompt (PHP Agent) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Shows how to invoke the PHP agent with a specific prompt to guide its execution. This example asks for an explanation of PHP 8.3 typed class constants. ```shell Task( subagent_type="php:01-php-fundamentals", prompt="Explain PHP 8.3 typed class constants with examples" ) ``` -------------------------------- ### TDD Implementation Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/06-php-testing.md Illustrates how to use the plugin for Test-Driven Development (TDD) by prompting for the creation of a class and its tests first. ```shell Task( subagent_type="php:06-php-testing", prompt="TDD: Create PaymentProcessor with tests first" ) ``` -------------------------------- ### Invoke php-api Skill with Claude Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-api/references/GUIDE.md Demonstrates how to invoke the php-api skill using the Claude command-line interface. This involves providing a task description following the 'php-api -' prefix. Ensure the plugin is installed and configured before use. ```bash # Invoke the skill claude "php-api - [your task description]" # Example claude "php-api - analyze the current implementation" ``` -------------------------------- ### Basic PHP API Implementation Pattern Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-api/references/GUIDE.md Provides a Python example demonstrating a basic implementation pattern for the php-api skill. It includes input validation and a placeholder for processing logic. This pattern emphasizes validating input data before proceeding with operations. ```python # Example implementation pattern def implement_php_api(input_data): """ Implement php-api functionality. Args: input_data: Input to process Returns: Processed result """ # Validate input if not input_data: raise ValueError("Input required") # Process result = process(input_data) # Return return result ``` -------------------------------- ### Beginner PHP Syntax Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/SKILL.md Demonstrates basic PHP syntax for beginners, including variable declaration, type hinting, and the use of the `match` expression (PHP 8.0+). ```php 'OK', 404 => 'Not Found', default => 'Unknown', }; ``` -------------------------------- ### Verify Plugin Installation Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/README.md Displays the expected output after restarting the Claude Code environment to confirm that the specialized agents are correctly loaded and available for use. ```text php-assistant:09-management-design php-assistant:04-data-analytics php-assistant:05-ai-ml-mlops php-assistant:02-backend-servers php-assistant:08-specialized-tech ``` -------------------------------- ### Create API Resource Controller Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-laravel/SKILL.md Provides a controller example for handling API requests, utilizing Eloquent resources for consistent JSON output and pagination. ```php paginate(15) ); } public function store(StorePostRequest $request) { $post = Post::create($request->validated()); return (new PostResource($post)) ->response() ->setStatusCode(Response::HTTP_CREATED); } } ``` -------------------------------- ### Basic php-wordpress Implementation (Python) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-wordpress/references/GUIDE.md Provides an example implementation pattern for the php-wordpress skill using Python. This function includes basic input validation and a placeholder for processing logic. It returns the processed result or raises a ValueError if input is missing. ```python # Example implementation pattern def implement_php_wordpress(input_data): """ Implement php-wordpress functionality. Args: input_data: Input to process Returns: Processed result """ # Validate input if not input_data: raise ValueError("Input required") # Process result = process(input_data) # Return return result ``` -------------------------------- ### GET /roadmap/compare Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/commands/roadmap.md Compares two different developer roadmaps to identify overlapping skills and differences. ```APIDOC ## GET /roadmap/compare ### Description Compares two distinct developer roadmaps to help users understand the transition or differences between roles. ### Method GET ### Endpoint /roadmap [role1] vs [role2] ### Parameters #### Path Parameters - **role1** (string) - Required - The first role to compare. - **role2** (string) - Required - The second role to compare. ### Request Example /roadmap Frontend Developer vs Full-Stack Developer ### Response #### Success Response (200) - **comparison** (object) - A breakdown of shared and unique learning modules between the two roles. #### Response Example { "shared_skills": ["HTML", "CSS", "JavaScript"], "unique_to_role1": ["Design Systems"], "unique_to_role2": ["Database Management", "API Design"] } ``` -------------------------------- ### Intermediate PHP OOP Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/SKILL.md Illustrates Object-Oriented Programming in PHP using constructor property promotion (PHP 8.0+). Defines a `User` class with readonly properties. ```php calculator = new Calculator(); } #[Test] public function it_adds_two_numbers(): void { $result = $this->calculator->add(2, 3); $this->assertSame(5, $result); } #[Test] #[DataProvider('divisionProvider')] public function it_divides_correctly(int $a, int $b, float $expected): void { $result = $this->calculator->divide($a, $b); $this->assertEqualsWithDelta($expected, $result, 0.0001); } public static function divisionProvider(): array { return [ 'whole' => [10, 2, 5.0], 'decimal' => [7, 2, 3.5], ]; } #[Test] public function it_throws_on_division_by_zero(): void { $this->expectException(\DivisionByZeroError::class); $this->calculator->divide(10, 0); } } ``` -------------------------------- ### Configure Response Optimization (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Configures how the PHP agent optimizes its responses, specifically for code examples and explanations. It sets limits on the number and length of code examples and defines the style and content of explanations, including whether to include 'why' and alternative solutions. ```yaml response: code_examples: max_per_response: 3 max_lines_each: 50 explanations: style: "concise" # concise | detailed | tutorial include_why: true include_alternatives: true ``` -------------------------------- ### Advanced PHP 8.4 Features Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/SKILL.md Showcases advanced PHP 8.4 features, specifically property hooks for getter and setter logic. Demonstrates controlling access and validation for class properties. ```php $this->celsius; set => $value >= -273.15 ? $value : throw new \InvalidArgumentException(); } public float $fahrenheit { get => $this->celsius * 9/5 + 32; set => $this->celsius = ($value - 32) * 5/9; } } ``` -------------------------------- ### Troubleshooting: Incomplete Type Suggestions (PHP) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Explains why the PHP agent might not suggest generics, as native PHP lacks this feature. The agent compensates by suggesting PHPStan/Psalm annotations as an alternative, providing an example format. ```text Symptom: Agent doesn't suggest generics Cause: Native PHP doesn't support generics Fix: Agent will suggest PHPStan/Psalm annotations instead Example: /** @param array $users */ ``` -------------------------------- ### GitHub Actions CI/CD Pipeline for PHP Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-testing/SKILL.md A GitHub Actions workflow configuration to automate PHP testing, dependency installation, and code coverage reporting. It targets PHP 8.3 and integrates with Codecov. ```yaml name: Tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: '8.3' coverage: xdebug - name: Install dependencies run: composer install --no-progress - name: Run tests run: vendor/bin/phpunit --coverage-clover coverage.xml - name: Upload coverage uses: codecov/codecov-action@v3 ``` -------------------------------- ### PHP WebTestCase for Product Listing Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-symfony/SKILL.md A PHPUnit test case using Symfony's WebTestCase to verify the product listing API endpoint. It initializes a client, makes a GET request to '/api/products', and asserts a successful response. No external dependencies beyond Symfony's testing framework are required. ```php request('GET', '/api/products'); $this->assertResponseIsSuccessful(); } } ``` -------------------------------- ### User Learning Journey Data Flow Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/ARCHITECTURE.md Visualizes the data flow for a user's learning journey, starting from initiation through commands and agents, to skill acquisition and assessment. ```text User initiates ↓ [/learn command] ↓ Agent guides through roles ↓ User selects role ↓ [/roadmap command] ↓ Detailed learning path provided ↓ Personalized skills modules ↓ [/assess command] ↓ Knowledge evaluation ↓ Recommendations generated ↓ Progress tracked via hooks ``` -------------------------------- ### GET /api/v1/users Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-api/SKILL.md Retrieves a paginated list of users from the system. ```APIDOC ## GET /api/v1/users ### Description Retrieves a list of users. Supports pagination via query parameters. ### Method GET ### Endpoint /api/v1/users ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number for pagination. ### Response #### Success Response (200) - **data** (array) - A collection of user objects. #### Response Example { "data": [ { "id": 1, "email": "user@example.com", "name": "John Doe" } ] } ``` -------------------------------- ### WordPress Hook System Reference Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/04-php-wordpress.md A reference guide for common WordPress action and filter hooks, including standard priority guidelines for execution order. ```php // Action Hooks (most used) // init, wp_loaded, template_redirect // admin_init, admin_menu, admin_enqueue_scripts // wp_enqueue_scripts, wp_head, wp_footer // save_post, pre_get_posts, the_post // rest_api_init, wp_ajax_{action} // Filter Hooks (most used) // the_content, the_title, the_excerpt // query_vars, pre_get_posts // body_class, post_class // wp_nav_menu_items, widget_text // rest_prepare_{post_type}, authenticate // Priority Guidelines // 10: Default priority // 1-9: Run before default // 11-99: Run after default // PHP_INT_MAX: Run last (cleanup) ``` -------------------------------- ### PHP Debugging: Mock Injection Example Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/06-php-testing.md Demonstrates the correct way to inject a mock object into a class in PHP, contrasting it with the incorrect approach of instantiating the dependency directly. This is crucial for isolating units during testing. ```php // Wrong: Class creates own instance $service = new UserService(); // Creates real dependency // Right: Inject mock $mock = Mockery::mock(Repository::class); $service = new UserService($mock); ``` -------------------------------- ### Implement Doctrine Entity Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-symfony/SKILL.md A standard Doctrine ORM entity example using PHP 8.2+ attributes for mapping and validation constraints. ```php createdAt = new \DateTimeImmutable(); } } ``` -------------------------------- ### Invoke Database Subagent Tasks Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/05-php-database.md Examples of how to invoke the database subagent for query optimization and schema design tasks. ```text Task(subagent_type="php:05-php-database") Task( subagent_type="php:05-php-database", prompt="Optimize this query for large dataset", context={"sql": "SELECT * FROM orders WHERE created_at > ?"} ) Task( subagent_type="php:05-php-database", prompt="Design schema for e-commerce with products, orders, and inventory" ) ``` -------------------------------- ### Invoke php-database Skill (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-database/references/GUIDE.md Demonstrates how to invoke the 'php-database' skill using the command-line interface. This is the primary method for interacting with the skill for various tasks. ```bash # Invoke the skill claude "php-database - [your task description]" # Example claude "php-database - analyze the current implementation" ``` -------------------------------- ### Basic PHP Database Implementation Pattern (Python) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-database/references/GUIDE.md Provides a Python function template illustrating a basic implementation pattern for the php-database skill. It includes input validation, processing, and return value handling. ```python # Example implementation pattern def implement_php_database(input_data): """ Implement php-database functionality. Args: input_data: Input to process Returns: Processed result """ # Validate input if not input_data: raise ValueError("Input required") # Process result = process(input_data) # Return return result ``` -------------------------------- ### External Dependencies and Tools (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/04-php-wordpress.md YAML configuration detailing external dependencies and recommended development tools. It specifies required versions for PHP and WordPress, lists helpful CLI tools and plugins, and outlines tools for block development and local environment setup. ```yaml assumes_installed: - php: ">=8.0" - wordpress: ">=6.4" recommended_tools: - wp-cli: "Command line management" - query-monitor: "Debugging plugin" - debug-bar: "Debug toolbar" development_tools: - @wordpress/create-block: "Block scaffolding" - @wordpress/scripts: "Build tools" - @wordpress/env: "Local development" ``` -------------------------------- ### Basic Implementation Pattern (Python) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-testing/references/GUIDE.md Provides a Python function template for implementing the php-testing functionality. It includes basic input validation and a placeholder for processing logic. ```python # Example implementation pattern def implement_php_testing(input_data): """ Implement php-testing functionality. Args: input_data: Input to process Returns: Processed result """ # Validate input if not input_data: raise ValueError("Input required") # Process result = process(input_data) # Return return result ``` -------------------------------- ### External Dependencies for Laravel Plugin (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md Lists the external software and packages assumed to be installed or recommended for the Laravel plugin. It specifies minimum versions for PHP, Composer, and Laravel, and suggests useful development packages like Telescope and Debugbar. ```yaml assumes_installed: - php: ">=8.2" - composer: ">=2.5" - laravel: ">=10.0" recommended_packages: - laravel/telescope: "Development debugging" - laravel/horizon: "Queue monitoring" - barryvdh/laravel-debugbar: "Request debugging" - spatie/laravel-permission: "Role & permissions" ``` -------------------------------- ### Invoke php-wordpress Skill (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-wordpress/references/GUIDE.md Demonstrates how to invoke the php-wordpress skill using the 'claude' command-line tool. This involves providing the skill name followed by a task description. Ensure the plugin is installed and configured before use. ```bash # Invoke the skill claude "php-wordpress - [your task description]" # Example claude "php-wordpress - analyze the current implementation" ``` -------------------------------- ### Interactive Learning and Assessment Commands Source: https://context7.com/pluginagentmarketplace/custom-plugin-php/llms.txt Provides CLI commands for initiating learning journeys, retrieving career roadmaps, and performing skill assessments. These commands help developers track progress and identify knowledge gaps across various technical domains. ```bash # Start the learning journey /learn # Get full roadmap for a specific role /roadmap Backend Developer # Browse by category /roadmap --category frontend # Get time estimate /roadmap Backend Developer --time-estimate # Compare two roadmaps /roadmap Frontend Developer vs Backend Developer # Run skill assessment /assess # Browse available roles /browse-role ``` -------------------------------- ### Retrieve Developer Roadmaps via CLI Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/commands/roadmap.md Commands to fetch detailed learning paths for specific roles, browse by category, calculate time estimates, or compare different career paths. ```bash # Get a full roadmap for a specific role /roadmap "Backend Developer" # Browse roadmaps by category /roadmap --category frontend /roadmap --category mobile # Get a time estimate for a specific role /roadmap "Frontend Developer" --time-estimate # Compare two different roadmaps /roadmap "React Developer" vs "Vue Developer" ``` -------------------------------- ### Optimize SQL Queries with Indexing Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-database/SKILL.md Demonstrates how to improve query performance by transitioning from full table scans to index scans. It includes the creation of an index and the use of the EXPLAIN command to verify the execution plan. ```sql -- Before: Full table scan SELECT * FROM orders WHERE status = 'pending'; -- Step 1: Add index CREATE INDEX idx_orders_status ON orders(status); -- Step 2: Analyze with EXPLAIN EXPLAIN SELECT * FROM orders WHERE status = 'pending'; ``` -------------------------------- ### GET /users/{user} Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/07-php-api.md Retrieves the details of a specific user by their ID. ```APIDOC ## GET /users/{user} ### Description Fetches detailed information for a specific user, including profile and roles. ### Method GET ### Endpoint /users/{user} ### Parameters #### Path Parameters - **user** (integer) - Required - The ID of the user. ### Response #### Success Response (200) - **id** (integer) - User ID. - **name** (string) - User name. - **email** (string) - User email. #### Response Example { "id": 1, "name": "John Doe", "email": "john@example.com" } ``` -------------------------------- ### Invoke php-fundamentals via CLI Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/references/GUIDE.md Demonstrates how to trigger the php-fundamentals skill using the command line interface. This is the primary method for interacting with the plugin functionality. ```bash claude "php-fundamentals - [your task description]" # Example claude "php-fundamentals - analyze the current implementation" ``` -------------------------------- ### GET /users Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/07-php-api.md Retrieves a paginated list of users with optional search and status filtering. ```APIDOC ## GET /users ### Description Returns a paginated collection of users. Supports searching and filtering by status. ### Method GET ### Endpoint /users ### Parameters #### Query Parameters - **search** (string) - Optional - Search term for filtering users. - **status** (string) - Optional - Filter users by their account status. - **per_page** (integer) - Optional - Number of items per page (default: 15). ### Request Example GET /users?search=john&status=active&per_page=10 ### Response #### Success Response (200) - **data** (array) - List of user objects. - **meta** (object) - Pagination metadata. #### Response Example { "data": [ { "id": 1, "name": "John Doe", "email": "john@example.com" } ], "meta": { "current_page": 1, "total": 1 } } ``` -------------------------------- ### GET /roadmap Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/commands/roadmap.md Retrieves a detailed learning roadmap for a specific developer role or filters roadmaps by category. ```APIDOC ## GET /roadmap ### Description Fetches a comprehensive learning roadmap for a specified developer role or lists roadmaps filtered by a category. ### Method GET ### Endpoint /roadmap ### Parameters #### Query Parameters - **role** (string) - Optional - The specific developer role (e.g., "Backend Developer"). - **category** (string) - Optional - Filter roadmaps by category (e.g., "frontend", "mobile", "ai"). - **time-estimate** (boolean) - Optional - If true, includes time estimates for the specified role. ### Request Example /roadmap Backend Developer ### Response #### Success Response (200) - **roadmap** (object) - The structured learning path including prerequisites, phases, and resources. - **time_estimate** (string) - Estimated time to completion (if requested). #### Response Example { "role": "Backend Developer", "phases": [ {"name": "Fundamentals", "duration": "1-3 months"}, {"name": "Development", "duration": "3-6 months"} ], "resources": ["Documentation", "Courses"] } ``` -------------------------------- ### Initialize Database Optimization Skill Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-database/SKILL.md A configuration snippet used to initialize the database optimization skill module with specific topic and proficiency level parameters. ```javascript Skill("php-database", {topic: "optimization", level: "advanced"}) ``` -------------------------------- ### Implement Messenger Message Handler Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-symfony/SKILL.md Example of a Symfony Messenger message handler using the AsMessageHandler attribute to process asynchronous tasks. ```php emailService->sendOrderConfirmation($message->orderId); } } ``` -------------------------------- ### Create Service with Dependency Injection Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-symfony/SKILL.md Demonstrates a read-only service class utilizing constructor injection, autowiring, and parameter injection for Symfony services. ```php setName($data['name']); $this->entityManager->persist($product); $this->entityManager->flush(); $this->logger->info('Product created', ['id' => $product->getId()]); return $product; } } ``` -------------------------------- ### Invoke PHP Assistant Agents Source: https://context7.com/pluginagentmarketplace/custom-plugin-php/llms.txt Demonstrates how to trigger specific PHP development agents using the Task interface. Each snippet shows the base invocation and optional context-aware prompts for framework-specific tasks. ```bash # PHP Fundamentals Task(subagent_type="php:01-php-fundamentals") # Laravel Framework Task(subagent_type="php:02-php-laravel") # Symfony Framework Task(subagent_type="php:03-php-symfony") # WordPress Development Task(subagent_type="php:04-php-wordpress") # Database Operations Task(subagent_type="php:05-php-database") # Testing Task(subagent_type="php:06-php-testing") # API Development Task(subagent_type="php:07-php-api") ``` -------------------------------- ### Troubleshooting: Composer Autoloading Issues (PHP) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Provides a checklist for resolving 'Class not found' errors related to Composer autoloading in PHP projects. It includes steps like running `composer dump-autoload`, verifying PSR-4 mappings, file locations, and checking case sensitivity. ```text Symptom: "Class not found" errors Debug Checklist: [ ] Run composer dump-autoload [ ] Check PSR-4 namespace mapping in composer.json [ ] Verify file location matches namespace [ ] Check case sensitivity (Linux) ``` -------------------------------- ### Troubleshooting Migration Errors in Laravel (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md Provides a debug checklist and commands for resolving migration errors in Laravel, including issues with foreign keys or migration order. It suggests checking migration status, rollback options, and fresh migrations. ```bash Symptom: Migration fails or foreign key issues Debug Checklist: [ ] Check migration order (timestamps) [ ] Verify referenced tables exist [ ] Check column types match for foreign keys [ ] Run: php artisan migrate:status Commands: php artisan migrate:rollback --step=1 php artisan migrate:fresh --seed # Development only! ``` -------------------------------- ### Invoke php-testing Skill (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-testing/references/GUIDE.md Demonstrates how to invoke the php-testing skill using the CLAIDE command-line interface. This is the primary method for interacting with the skill for various tasks. ```bash # Invoke the skill claude "php-testing - [your task description]" # Example claude "php-testing - analyze the current implementation" ``` -------------------------------- ### Execute Skill Usage Command Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-laravel/SKILL.md A configuration command used to define skill levels and topics for the development environment. ```text Skill("php-laravel", {topic: "eloquent", level: "intermediate"}) ``` -------------------------------- ### Skill Registration Syntax Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-testing/SKILL.md A simple configuration snippet used to register testing skills within the marketplace environment. ```text Skill("php-testing", {topic: "mocking", level: "intermediate"}) ``` -------------------------------- ### Invoke API Agent Tasks Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/07-php-api.md Examples of how to invoke the PHP API subagent for various tasks including basic invocation, RESTful endpoint design, and OAuth 2.0 implementation. ```text Task(subagent_type="php:07-php-api") Task( subagent_type="php:07-php-api", prompt="Design REST API for user management with pagination" ) Task( subagent_type="php:07-php-api", prompt="Implement OAuth 2.0 authorization code flow with PKCE" ) ``` -------------------------------- ### Configure Optimization and Caching Patterns Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/05-php-database.md YAML configuration for managing agent context and enabling query analysis caching to improve performance. ```yaml optimization: max_context_files: 6 priority_loading: - composer.json - database/migrations/ - app/Models/*.php - src/Entity/*.php - config/database.php cache_patterns: - explain_results: true - schema_info: true - index_info: true ``` -------------------------------- ### Define API Agent Input and Output Interfaces Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/07-php-api.md TypeScript interfaces defining the structure for API development requests and the resulting agent responses, including code examples and OpenAPI specifications. ```typescript interface AgentInput { query: string; context?: { api_style?: "rest" | "graphql" | "rpc"; auth_method?: "jwt" | "oauth2" | "api_key" | "session"; framework?: "laravel" | "symfony" | "slim" | "none"; openapi_version?: "3.0" | "3.1"; }; endpoint_description?: string; existing_api?: string; } interface AgentOutput { response: string; code_examples?: { type: "controller" | "middleware" | "resource" | "schema" | "test"; code: string; language: "php" | "yaml" | "json"; }[]; openapi_spec?: string; curl_examples?: string[]; security_notes?: string[]; } ``` -------------------------------- ### Generate Unit Tests with Context Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/06-php-testing.md Shows how to generate unit tests for a specific PHP class using the testing plugin. It includes the prompt for test generation and specifies the file context. ```shell Task( subagent_type="php:06-php-testing", prompt="Write unit tests for UserService class", context={"file": "app/Services/UserService.php"} ) ``` -------------------------------- ### Basic Laravel Plugin Invocation (Task) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md A basic example of invoking the custom PHP plugin for Laravel, specifying the subagent type. This is the simplest way to initiate the plugin for PHP Laravel tasks. ```shell Task(subagent_type="php:02-php-laravel") ``` -------------------------------- ### Laravel Agent Output Schema (TypeScript) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md Defines the structure for the output data returned by the Laravel Agent. It includes the main response, optional code examples, Artisan commands, package suggestions, and warnings. ```typescript interface AgentOutput { response: string; code_examples?: { file_type: "controller" | "model" | "migration" | "route" | "blade" | "config"; code: string; path_suggestion?: string; }[]; artisan_commands?: string[]; package_suggestions?: string[]; warnings?: string[]; } ``` -------------------------------- ### POST /users Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/07-php-api.md Creates a new user record in the system. ```APIDOC ## POST /users ### Description Creates a new user and returns the created resource. ### Method POST ### Endpoint /users ### Parameters #### Request Body - **name** (string) - Required - The user's full name. - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. ### Request Example { "name": "Jane Doe", "email": "jane@example.com", "password": "secret123" } ### Response #### Success Response (201) - **id** (integer) - The ID of the created user. #### Response Example { "id": 2, "name": "Jane Doe", "email": "jane@example.com" } ``` -------------------------------- ### Apply WordPress Security Best Practices Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-wordpress/SKILL.md Demonstrates essential security measures including input sanitization, output escaping, nonce verification, and capability checks for database queries. ```php get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}custom_table WHERE id = %d", $id ) ); ``` -------------------------------- ### Laravel Debugging Commands (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md A collection of essential Artisan commands for debugging and inspecting a Laravel application. Includes commands for viewing application information, listing routes, inspecting models, and checking configuration settings. ```bash # Full Laravel debug php artisan about # Route debugging php artisan route:list --path=api/users # Model inspection php artisan model:show User # Config check php artisan config:show database ``` -------------------------------- ### Integration Test Patterns Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/06-php-testing.md Describes patterns for integration testing in PHP, focusing on testing interactions between different components. Examples include database testing with transactions, API testing with fake HTTP clients, and queue/event testing. ```php // Integration Test Patterns - Database testing with transactions - API testing with fake HTTP - Queue testing with fake() - Event testing with fake() ``` -------------------------------- ### Troubleshooting Route Not Found (404) in Laravel (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md Checklist for diagnosing 'Route Not Found' (404) errors in Laravel, even when the route appears to be defined. It includes steps like checking route lists, clearing route caches, verifying HTTP methods, middleware, and route model binding. ```bash Symptom: Route exists but returns 404 Debug Checklist: [ ] Run: php artisan route:list | grep [ ] Check route caching: php artisan route:clear [ ] Verify HTTP method (GET vs POST) [ ] Check middleware groups [ ] Verify route model binding ``` -------------------------------- ### Learning Module: PHP Syntax Fundamentals (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/SKILL.md Outlines the topics, exercises, duration, and prerequisites for the PHP Syntax Fundamentals module. Covers basic language constructs and error handling. ```yaml topics: - Variables and data types - Operators and expressions - Control structures (if, switch, match) - Loops (for, foreach, while) - Functions and closures - Error handling basics exercises: - Build a calculator function - Create array manipulation utilities - Implement string processing functions duration: 8-12 hours prerequisites: none ``` -------------------------------- ### PHP Database Agent Output Schema Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/05-php-database.md Specifies the structure for responses from the PHP Database Agent. It includes a primary response string, optional code examples for migrations, models, queries, or schemas, optimization tips, and suggested indexes. ```typescript interface AgentOutput { response: string; code_examples?: { type: "migration" | "model" | "repository" | "query" | "schema"; code: string; explanation: string; }[]; optimization_tips?: { issue: string; solution: string; impact: "high" | "medium" | "low"; }[]; indexes_suggested?: { table: string; columns: string[]; type: "btree" | "hash" | "fulltext" | "spatial"; }[]; } ``` -------------------------------- ### PHP ORM Patterns and Anti-Patterns Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/05-php-database.md Illustrates common patterns and anti-patterns for using Eloquent and Doctrine ORMs in PHP. It covers eager loading, batch processing, and highlights common pitfalls like N+1 queries and SELECT * usage. ```php // Eloquent Patterns - Eager loading (with, load) - Lazy eager loading - Subquery selects - Chunk processing - Cursor iteration // Doctrine Patterns - DQL vs QueryBuilder - Batch processing - Partial objects - Result caching - Proxies and lazy loading // Anti-Patterns to Avoid - N+1 queries - SELECT * usage - Missing indexes - Over-fetching - Ignoring query limits ``` -------------------------------- ### Configure Token & Cost Optimization (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Defines settings for optimizing token usage and context management within the PHP agent. Includes limits for files, lines per file, summarization triggers, and priority loading of specific files like composer.json and PHP interfaces/abstract classes. ```yaml optimization: max_context_files: 5 max_lines_per_file: 200 summarize_after_lines: 100 cache_common_patterns: true priority_loading: - composer.json # Always load first - src/*/Interface*.php # Interface definitions - src/*/Abstract*.php # Base classes ``` -------------------------------- ### Define External Dependencies (YAML) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/01-php-fundamentals.md Lists the external software and versions the PHP agent assumes are installed, such as PHP itself and Composer. It also includes optional dependencies like PHPStan and PHP-CS-Fixer for enhanced static analysis and code style checks. ```yaml assumes_installed: - php: ">=8.0" - composer: ">=2.0" optional: - phpstan: "For static analysis examples" - php-cs-fixer: "For code style examples" ``` -------------------------------- ### POST /api/v1/users Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-api/SKILL.md Creates a new user record in the database. ```APIDOC ## POST /api/v1/users ### Description Creates a new user account with the provided details. ### Method POST ### Endpoint /api/v1/users ### Parameters #### Request Body - **email** (string) - Required - User email address. - **name** (string) - Required - User full name. ### Request Example { "email": "newuser@example.com", "name": "Jane Doe" } ### Response #### Success Response (201) - **status** (string) - Confirmation message. #### Response Example { "status": "Created" } ``` -------------------------------- ### Troubleshooting Queue Jobs Not Processing in Laravel (Bash) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md A guide to debugging issues where queue jobs are not processing in Laravel. It covers checking the queue connection, verifying worker status, examining the `failed_jobs` table, and reviewing job logic, along with relevant Artisan commands. ```bash Symptom: Jobs stuck in queue Debug Checklist: [ ] Check QUEUE_CONNECTION in .env [ ] Verify queue worker is running [ ] Check failed_jobs table [ ] Review job's handle() method Commands: php artisan queue:work --tries=3 php artisan queue:retry all php artisan queue:failed ``` -------------------------------- ### PHPUnit Test for Calculator Addition Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-fundamentals/SKILL.md This snippet demonstrates a basic PHPUnit test case for a Calculator class, specifically testing the 'add' method. It utilizes PHP 8 attributes for test identification and strict types for type safety. Ensure PHPUnit is installed as a development dependency. ```php assertSame(5, $calculator->add(2, 3)); } } ``` -------------------------------- ### Create CRUD Resource with Laravel Plugin (Task) Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/02-php-laravel.md Example of using the custom PHP plugin to generate a complete CRUD (Create, Read, Update, Delete) resource for a Post model, including API endpoints. This leverages the plugin's ability to scaffold common Laravel features. ```shell Task( subagent_type="php:02-php-laravel", prompt="Create a complete CRUD for Post model with API endpoints" ) ``` -------------------------------- ### Implement Unit Tests with PHPUnit and Pest Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/skills/php-testing/SKILL.md Demonstrates standard unit testing practices using PHPUnit 11 attributes and the Pest testing framework's expressive syntax. ```php calculator = new Calculator(); } #[Test] public function it_adds_two_numbers(): void { $result = $this->calculator->add(2, 3); $this->assertSame(5, $result); } #[Test] #[DataProvider('divisionProvider')] public function it_divides_correctly(int $a, int $b, float $expected): void { $result = $this->calculator->divide($a, $b); $this->assertEqualsWithDelta($expected, $result, 0.0001); } public static function divisionProvider(): array { return [ 'whole' => [10, 2, 5.0], 'decimal' => [7, 2, 3.5], ]; } #[Test] public function it_throws_on_division_by_zero(): void { $this->expectException(\DivisionByZeroError::class); $this->calculator->divide(10, 0); } } ``` ```php 'John', 'email' => 'john@example.com', 'password' => 'password', 'password_confirmation' => 'password', ]) ->assertRedirect('/dashboard'); assertDatabaseHas('users', ['email' => 'john@example.com']); }); it('requires valid email', function () { post('/register', ['email' => 'invalid']) ->assertSessionHasErrors('email'); }); })->group('auth'); ``` -------------------------------- ### Optimize Database Queries with Eloquent Source: https://context7.com/pluginagentmarketplace/custom-plugin-php/llms.txt Demonstrates techniques to prevent N+1 query issues using eager loading and memory-efficient data processing patterns like cursors and chunking. These methods are essential for maintaining performance in Laravel applications when handling large datasets. ```php // Example: Preventing N+1 queries with eager loading // Bad: N+1 problem - one query per post $posts = Post::all(); foreach ($posts as $post) { echo $post->author->name; // Query executed for each post } // Good: Eager loaded - only 2 queries total $posts = Post::with('author')->get(); foreach ($posts as $post) { echo $post->author->name; // No additional query } // Better: Cursor for memory efficiency on large datasets foreach (User::cursor() as $user) { // Process user without loading all into memory } // Chunk processing for batch operations User::chunk(1000, function($users) { foreach ($users as $user) { // Process in batches of 1000 } }); ``` -------------------------------- ### Unit Test Patterns Source: https://github.com/pluginagentmarketplace/custom-plugin-php/blob/main/agents/06-php-testing.md Illustrates common patterns for writing effective unit tests in PHP, such as Arrange-Act-Assert (AAA) and Given-When-Then (BDD). It also covers the use of test doubles and dependency injection for enhanced testability. ```php // Unit Test Patterns - Arrange-Act-Assert (AAA) - Given-When-Then (BDD) - Test doubles (mocks, stubs, spies, fakes) - Dependency injection for testability ```