Basic information
About php-best-practices
PHP best practices, PSR standards, and code quality guidelines.
php-best-practices is an agent skill listed in the AddMCP.net directory, published by HoangNguyen0403. Runtime: TypeScript. License: MIT. The repository has 582 GitHub stars. Source code is hosted on github.com. Related topics: agent, agentic-ai, android, angular, best-practices.
Overview
What is php-best-practices?
name: PHP Best Practices description: PHP best practices, PSR standards, and code quality guidelines. metadata: labels: [php, psr, best-practices] triggers: files: ['**/*.php'] keywords: [psr-12, camelCase, PascalCase, dry, solid]
PHP Best Practices
Structure
src/
├── {Domain}/ # e.g., Services, Repositories
└── Helpers/ # Pure functions/TraitsImplementation Guidelines
- PSR-12: Follow PSR-12 for coding style (indent, braces, space).
- Autoloading: Use PSR-4 via Composer.
- Namespacing: Map namespaces to directory structure.
- PascalCase: Use for all class names.
- camelCase: Use for methods and variables.
- SNAKE_CASE: Use for class constants.
- DRY Logic: Extract repetitive logic into traits/methods.
- SOLID: Use interfaces for decoupling and SRP adherence.
Anti-Patterns
- God Classes: No Monoliths: Avoid classes with multiple responsibilities.
- Magic Numbers: No Hardcoding: Use class constants for config values.
- Deep Nesting: No Nesting: Guard clauses over nested if/else.
- Direct Output: No Echo: Return data; let controller handle response.
References
- [Clean Code Patterns](references/implementation.md)
31:T18c2,
Videos
Tutorials, guides, and showcases related to php-best-practices. The player loads when you press play.
Videos belong to their creators. Relevance is approximate; check the channel and description before following setup steps.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In