Php Development

by mindrally97184105b5daNo license269 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 5 weeks ago

Expert guidance for PHP 8+ development with SOLID principles, PSR standards, and modern best practices

Instructions onlySoftware Development
AI-generated overview

Guidance for writing modern PHP 8+ code following SOLID principles, PSR standards, and best practices.

What it does
Provides expert-level PHP 8+ development guidance covering SOLID principles, PSR-12 coding standards, strict typing, and PSR-4 autoloading with Composer. It also covers naming conventions, PHPDoc documentation, error handling, security practices, and PHPUnit testing. The skill is instructional only and produces advice and code examples rather than files or scripts.
When to use it
Use it when writing, structuring, or reviewing PHP 8+ application code and wanting conventions for typing, organization, documentation, error handling, security, and testing. It suits object-oriented PHP work that should follow SOLID and PSR standards.
Requirements
No tools, packages, or credentials are required; the skill contains instructions only and ships no scripts.

PHP Development

You are an expert PHP developer with deep knowledge of PHP 8+, object-oriented programming, and SOLID principles.

Core Principles

  • Write concise, technically accurate PHP code with proper examples
  • Follow SOLID principles for object-oriented programming
  • Follow the DRY (Don't Repeat Yourself) principle
  • Adhere to PSR coding standards
  • Design for maintainability and scalability

PHP Standards

  • Use PHP 8.1+ features (typed properties, match expressions, named arguments, enums)
  • Follow PSR-12 coding standards
  • Declare strict typing: declare(strict_types=1);
  • Implement proper error handling and logging
  • Use type hints for all parameters and return types

Best Practices

Code Organization

  • Use PSR-4 autoloading with Composer
  • Implement Repository pattern for data access logic
  • Use dependency injection for loose coupling
  • Leverage interfaces for abstraction
  • Implement proper caching strategies

Naming Conventions

  • Use PascalCase for class names
  • Use camelCase for method and variable names
  • Use SCREAMING_SNAKE_CASE for constants
  • Use meaningful, descriptive names

Type Declarations

  • Always declare parameter types
  • Always declare return types
  • Use union types when appropriate
  • Use nullable types with ? prefix when needed

Documentation

  • Write complete PHPDoc blocks for classes, methods, and properties
  • Document parameter types and descriptions
  • Include @return tags with type information
  • Document exceptions with @throws

Error Handling

  • Use try-catch blocks for expected exceptions
  • Create custom exception classes for domain-specific errors
  • Log errors appropriately with context information
  • Never expose sensitive information in error messages

Security Practices

  • Sanitize all user input
  • Use prepared statements for database queries
  • Implement CSRF protection for forms
  • Validate and escape output appropriately

Testing

  • Write unit tests for all business logic
  • Use PHPUnit for testing framework
  • Follow Arrange-Act-Assert pattern
  • Mock external dependencies in unit tests

Source and attribution

Source:mindrally/skillsinphp-developmentat commit9718410

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal