php-conventions

php-conventions is a skill for Claude Code from AratKruglik/claude-sdlc. It costs 224 tokens per session (1,625 once invoked), scanned A, original, MIT.

A set of modern coding conventions for PHP 8.1 and newer, covering typing, common language features, and PSR-12 formatting rules.

In plain words
What is it for?
Use it when writing or reviewing PHP classes, choosing language features, and keeping code compatible with the project's minimum PHP version.
Why use it?
It reduces bugs caused by loose types, inconsistent style, and avoidable boilerplate. It also helps code remain readable across PHP projects.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the php-foundation plugin — 3 skills shipped together

Good fit Use it when writing or reviewing PHP classes, choosing language features, and keeping code compatible with the project's minimum PHP version.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aratkruglik/claude-sdlc/php-conventions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add AratKruglik/claude-sdlc --skill php-conventions
Clone the repo
git clone --depth 1 https://github.com/AratKruglik/claude-sdlc

Made for: Claude Code.

Or install php-foundation, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for php-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/aratkruglik/claude-sdlc/php-conventions/github.svg)](https://agentmods.dev/skills/aratkruglik/claude-sdlc/php-conventions)
Your own site
<a href="https://agentmods.dev/skills/aratkruglik/claude-sdlc/php-conventions"><img src="https://agentmods.dev/badge/skills/aratkruglik/claude-sdlc/php-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for php-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/aratkruglik/claude-sdlc/php-conventions"><img src="https://agentmods.dev/badge/skills/aratkruglik/claude-sdlc/php-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 224 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,625 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00224 $0.01625
Opus 5.5 $0.00090 $0.00650
Sonnet 5.5 $0.00045 $0.00325
Haiku 4.5 $0.00022 $0.00162

Measured 29d ago against content hash 066859a52d1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

php-conventions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 29d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/php-foundation/skills/php-conventions/SKILL.md · 215 lines

How it starts

The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PHP Conventions (stack-agnostic, PHP 8.1+)

This skill encodes idioms that reduce bugs and improve readability in any PHP codebase. Apply alongside the active framework plugin's conventions skill (e.g., laravel:laravel-conventions, symfony:symfony-conventions).

Detection

Read composer.json first to learn the target PHP version:

  • "require": { "php": "^8.1" } (or higher) → all idioms below apply.
  • "config": { "platform": { "php": "8.x" } } pins the resolver version.

Match the project's minimum version — do not use PHP 8.2+ features (e.g. readonly classes, DNF types) on an 8.1 project.

strict_types — always on

Every .php file with logic starts with:

<?php

declare(strict_types=1);

namespace App\Domain;

Strict typing turns silent coercions into TypeErrors at the boundary, catching bugs early. The declaration must be the first statement.

Constructor property promotion

Collapse the declare/assign boilerplate into the signature.

// Prefer
final class Money
{
    public function __construct(
        public readonly int $amount,
        public readonly Currency $currency,
    ) {
    }
}

// Avoid — manual field + assignment
final class Money
{
    private int $amount;
    private Currency $currency;

    public function __construct(int $amount, Currency $currency)
    {
        $this->amount = $amount;
        $this->currency = $currency;
    }
}

readonly properties — immutability by default

final class OrderLine
{
    public function __construct(
        public readonly string $sku,
        public readonly int $quantity,
    ) {
    }

    public function withQuantity(int $quantity): self
    {
        return new self($this->sku, $quantity); // return a new instance, never mutate
    }
}

readonly properties can be assigned once (from within the declaring scope) and never again. Use them for value objects and DTOs. On PHP 8.2+ a whole class may be marked readonly.

Enums — replace magic constants

Read the full file on GitHub · 215 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 29d ago Changed · +2 lines 066859a52d1e
  2. 1mo ago First seen · 213 lines · 224 tokens per session scan A 204503e2e64b

Subscribe to this mod's changes

php-conventions is a skill published in the GitHub repository AratKruglik/claude-sdlc (43 stars, last pushed 4d ago), licensed MIT. It adds 224 tokens to every session and 1,625 once invoked, about $0.0009 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories