php-conventions

Enforce modern PHP 8.1+ idioms including strict typing and PSR-12 styling.

9|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill php-conventions-aratkruglik
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-conventions
Source: https://github.com/AratKruglik/antigravity-sdlc/tree/main/plugins/php-foundation/skills/php-conventions
Command: npx skills add https://github.com/AratKruglik/antigravity-sdlc --skill php-conventions-aratkruglik

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines PHP projects by enforcing modern idioms (PHP 8.1+) to reduce bugs and improve readability.

Core Features & Use Cases

  • Strict typing by default across files via declare(strict_types=1) to catch type errors early.
  • Boilerplate reduction through constructor property promotion and readonly/typed properties.
  • Modern constructs like enums, match expressions, and named arguments to improve safety and clarity.

Real-world example: A Money value object uses readonly properties and a backed Currency enum to model amount and currency.

Quick Start

Enable PHP conventions on your codebase and progressively refactor files to adopt strict_types, readonly properties, enums, and match expressions.

Frequently Asked Questions about php-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce strict typing across my PHP codebase?

Enforce strict typing in PHP by using declare(strict_types=1) at the top of files to catch type errors early. This Skill applies strict typing by default across your project to reduce bugs and improve readability.

What is the best way to reduce boilerplate in PHP class properties?

Reduce PHP class boilerplate using constructor property promotion and readonly typed properties. This Skill enforces these modern PHP 8.1+ idioms to streamline initialization and guarantee immutability for safer code.

Can I use enums and match expressions in older PHP frameworks?

Enums and match expressions require PHP 8.1+. This Skill targets modern PHP 8.1+ codebases and frameworks, applying these constructs to improve safety and clarity over traditional switch statements and class constants.

How do I refactor PHP code to comply with PSR-12 styling?

Refactor PHP code to PSR-12 styling by progressively adopting modern idioms like strict_types, readonly properties, and named arguments. This Skill enforces PSR-12 styling alongside modern PHP constructs to reduce bugs and improve readability.

Does this PHP convention tool work with composer.json detection?

Yes, this tool satisfies detection via composer.json. It enforces modern PHP idioms across projects that adopt strict typing, enums, match expressions, and PSR-12 styling within PHP 8.1+ codebases.

When should I use readonly properties instead of traditional getters in PHP?

Use readonly properties to enforce immutability without writing boilerplate getter methods. This Skill applies readonly typed properties and constructor property promotion to model value objects cleanly, such as a Money object with a backed Currency enum.