← Back to Index
🐘
PHP Configuration
Web Modern
📥 Download PHP Package

📖 About PHP

PHP is a popular general-purpose scripting language especially suited for web development. Modern PHP (8.1+) brings significant improvements with strict typing, enums, readonly properties, and a mature ecosystem of frameworks and tools.

🎯 Best For
  • Web applications and APIs
  • Content Management Systems (WordPress, Drupal)
  • E-commerce platforms (Magento, WooCommerce)
  • Server-side scripting
  • Rapid web development
🔧 Key Features
  • Strict types with declare(strict_types=1)
  • Readonly properties for immutability
  • Enums for type-safe constants
  • Named arguments for clarity
  • Constructor property promotion
  • PSR standards for interoperability

🛠️ Development Tools

Build
composer install
Test
vendor/bin/phpunit
Coverage
vendor/bin/phpunit --coverage-html coverage
Lint
vendor/bin/phpstan analyse

📄 Package Contents (7 files)

📋
👁
AGENTS_RULES.md
Complete AI agent rules (universal)
  • PHP-specific best practices
  • TDD workflow (Red-Green-Refactor)
  • DDD principles and patterns
  • Git workflow and commit format
  • Code quality principles
⚙️
👁
.cursorrules
Quick reference for Cursor IDE
  • Essential rules summary
  • Links to full documentation
  • Optimized for quick loading
🚫
👁
.gitignore
Git exclusions
  • PHP-specific patterns
  • Build artifacts
  • IDE configuration files
  • Dependency directories
📖
👁
AGENTS.md
Quick reference guide
  • Common patterns
  • Best practices summary
  • Quick troubleshooting
📝
👁
README.md
Project template with examples
  • Setup instructions
  • Sample code and structure
  • Testing examples
  • Build and run commands
👁
CODE_QUALITY_PRINCIPLES.md
Quality principles and best practices
  • Avoid default values (fail-fast)
  • Consistency across code paths
  • Extract reusable functions
  • PHP-specific examples
🤝
👁
CONTRIBUTING.md
Contribution guidelines
  • TDD workflow (Red-Green-Refactor)
  • Git commit format
  • Code review process
  • Testing requirements (90% coverage)

💻 Code Examples

Strict Types & Readonly
<?php
declare(strict_types=1);

class User {
    public function __construct(
        public readonly string $name,
        public readonly string $email,
        public readonly int $age
    ) {}
}
Enums
enum Status: string {
    case PENDING = 'pending';
    case APPROVED = 'approved';
    case REJECTED = 'rejected';
}

$status = Status::PENDING;
Named Arguments
function createUser(
    string $name,
    string $email,
    int $age = 18
): User {
    return new User($name, $email, $age);
}

$user = createUser(
    name: 'John',
    email: 'john@example.com',
    age: 30
);

🔗 Related Languages