---
title: "PHP Coding Style"
description: "> This file extends the common coding style rule with PHP specific content."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/php-coding-style
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:31:58.508Z
license: CC-BY-4.0
attribution: "PHP Coding Style — Claudary (https://claudary.paisolsolutions.com/skills/php-coding-style)"
---

# PHP Coding Style
> This file extends the common coding style rule with PHP specific content.

## Overview

---
description: "PHP coding style extending common rules"
globs: ["**/*.php", "**/composer.json"]
alwaysApply: false
---
# PHP Coding Style

> This file extends the common coding style rule with PHP specific content.

## Standards

- Follow **PSR-12** formatting and naming conventions.
- Prefer `declare(strict_types=1);` in application code.
- Use scalar type hints, return types, and typed properties everywhere new code permits.

## Immutability

- Prefer immutable DTOs and value objects for data crossing service boundaries.
- Use `readonly` properties or immutable constructors for request/response payloads where possible.
- Keep arrays for simple maps; promote business-critical structures into explicit classes.

## Formatting

- Use **PHP-CS-Fixer** or **Laravel Pint** for formatting.
- Use **PHPStan** or **Psalm** for static analysis.

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/php-coding-style) · https://claudary.paisolsolutions.com
