php-modern

Master of Modern PHP (8.4-8.6+), specialized in Property Hooks, Partial Function Application, and High-Performance Engine optimization.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "php-modern" with this command: npx skills add yuniorglez/gemini-elite-core/yuniorglez-gemini-elite-core-php-modern

Skill: PHP Modern (Standard 2026)

Role: The Modern PHP Specialist is responsible for architecting robust, high-performance backends using the latest language features. In 2026, PHP has shed its legacy reputation, offering first-class syntax like Property Hooks, Pipe Operators, and Native URI handling. This skill focuses on leveraging these for "Clean Code" that executes with near-native efficiency.

🎯 Primary Objectives

  1. Syntactic Excellence: Mastery of PHP 8.4 Property Hooks and PHP 8.5/8.6 Pipe Operators (|>) and Partial Function Application.
  2. Type Safety: Utilizing Intersection Types, Disjunctive Normal Form (DNF) types, and #[NoDiscard] for bulletproof APIs.
  3. Engine Mastery: Optimizing JIT (Just-In-Time) compilation and persistent handle sharing for high-scale applications.
  4. Security First: Implementing modern cryptography (Sodium) and secure data encoding natively.

🏗️ The 2026 Toolbelt

1. Language Features

  • Property Hooks: Logic-embedded properties (no more boilerplate getters/setters).
  • Pipe Operator (|>): Left-to-right functional composition.
  • Clone With: Immutable state updates in a single expression.
  • Partial Function Application: Creating closures with placeholders (?).

2. Static Analysis & Tooling

  • PHPStan / Psalm (Level 9+): Mandatory for all Squaads codebases.
  • Rector: Automated migrations and code quality refactors.
  • Pest 3.x: Functional and architectural testing.

🛠️ Implementation Patterns

1. Property Hooks (PHP 8.4+)

Eliminating getters/setters for clean, reactive-like properties.

class User {
    public string $name {
        set => trim($value);
        get => ucfirst($this->name);
    }

    public string $fullName {
        get => "{$this->firstName} {$this->lastName}";
    }
}

2. Functional Piping (PHP 8.5+)

Standardizing data transformation pipelines.

$slug = $title
    |> trim(?)
    |> strtolower(?)
    |> preg_replace('/[^a-z0-9]+/', '-', ?);

3. Clone With (PHP 8.5+)

Updating immutable objects elegantly.

$newConfig = clone $config with [
    'timeout' => 5000,
    'retries' => 3
];

🚫 The "Do Not List" (Anti-Patterns)

  1. NEVER use var_dump in production-bound code. Use Sentry or Log::debug.
  2. NEVER use array() syntax. Use [].
  3. NEVER perform raw SQL queries. Use Eloquent or specialized Query Builders with parameter binding.
  4. NEVER use global keywords or $GLOBALS. Use Dependency Injection.
  5. NEVER ignore return values of functions marked with #[NoDiscard].

🛠️ Troubleshooting & Engine Optimization

IssueLikely Cause2026 Corrective Action
High LatencyJIT is cold or misconfiguredEnable opcache.jit=tracing and monitor buffer usage.
Memory LeakPersistent cURL handles not sharedUse curl_share_init() with persistent handles (PHP 8.5).
Type ErrorsLoose types in legacy modulesApply DNF types (e.g., `(A&B)
Slow Data ParsingNon-native URI/JSON handlingUse the native URI extension (PHP 8.5) and json_validate.

📚 Reference Library


📊 Quality Metrics

  • Static Analysis Pass: PHPStan Level 9.
  • Code Coverage: > 90% (Pest 3).
  • Complexity: Max cyclomatic complexity of 5 per method.

🔄 Evolution from 8.1 to 8.6

  • 8.1: Readonly properties, Enums.
  • 8.2: Readonly classes, DNF types.
  • 8.3: Typed class constants, json_validate.
  • 8.4: Property Hooks, Asymmetric visibility.
  • 8.5: Pipe Operator, Clone With, Native URI.
  • 8.6: Partial Function Application, Pattern Matching (Expected).

End of PHP Modern Standard (v1.1.0)

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

filament-pro

No summary provided by upstream source.

Repository SourceNeeds Review
General

pdf-pro

No summary provided by upstream source.

Repository SourceNeeds Review
General

remotion-expert

No summary provided by upstream source.

Repository SourceNeeds Review
General

tailwind4-expert

No summary provided by upstream source.

Repository SourceNeeds Review