php

php is a skill for Claude Code, Codex from miles990/claude-software-skills. It costs 6 tokens per session (3,414 once invoked), scanned A, original, MIT.

A guide to modern PHP programming, including typed properties, attributes, union types, and object-oriented code. PHP is a programming language commonly used for web applications.

In plain words
What is it for?
Use it when writing PHP classes, functions, constructors, return types, and code that works with collections or dates.
Why use it?
It helps you use newer PHP features to make code clearer and catch incorrect values earlier.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/miles990/claude-software-skills/php
Any agent
npx skills add miles990/claude-software-skills --skill php
Clone the repo
git clone --depth 1 https://github.com/miles990/claude-software-skills

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin php/plugin install php after adding the marketplace above.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/miles990/claude-software-skills/php.svg)](https://agentmods.dev/skills/miles990/claude-software-skills/php)
Your own site
<a href="https://agentmods.dev/skills/miles990/claude-software-skills/php"><img src="https://agentmods.dev/badge/skills/miles990/claude-software-skills/php.svg" alt="Measured on agentmods" height="20"></a>
Per session 6 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,414 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00006 $0.03414
Opus 5 $0.00003 $0.01707
Sonnet 5 $0.00001 $0.00683
Haiku 4.5 $0.00001 $0.00341

Measured 4d ago against content hash ba1758e3d45a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

php scanned grade A with 1 finding 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 4d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

$row = $stmt->fetch(PDO::FETCH_ASSOC);
programming-languages/php/SKILL.md · 690 lines

How it starts

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

PHP

Overview

Modern PHP (7.4+/8.x) patterns including typed properties, attributes, and modern OOP features.


Modern PHP Features

Type System

<?php

declare(strict_types=1);

// Typed properties (PHP 7.4+)
class User
{
    public string $id;
    public string $email;
    public ?string $name = null;
    public bool $active = true;
    public array $roles = [];
    public DateTimeImmutable $createdAt;

    // Constructor promotion (PHP 8.0+)
    public function __construct(
        public readonly string $email,
        public readonly string $name,
        private string $password
    ) {
        $this->id = uniqid();
        $this->createdAt = new DateTimeImmutable();
    }
}

// Union types (PHP 8.0+)
function process(string|int $value): string|int
{
    return is_string($value) ? strtoupper($value) : $value * 2;
}

// Intersection types (PHP 8.1+)
function processIterable(Countable&Iterator $items): int
{
    return count($items);
}

// Return types
function findUser(string $id): ?User
{
    return $this->repository->find($id);
}

function getUsers(): array
{
    return $this->repository->findAll();
}

// Never return type (PHP 8.1+)
function fail(string $message): never
{
    throw new RuntimeException($message);
}

// Nullable types
function setName(?string $name): void
{
    $this->name = $name;
}

Attributes (PHP 8.0+)

<?php

use Attribute;

// Define attribute
#[Attribute(Attribute::TARGET_PROPERTY)]
class Column
{
    public function __construct(
        public string $name,
        public string $type = 'string',
        public bool $nullable = false
    ) {}
}

#[Attribute(Attribute::TARGET_METHOD)]
class Route
{
    public function __construct(
        public string $path,
        public string $method = 'GET'
    ) {}
}

#[Attribute(Attribute::TARGET_CLASS)]
class Entity
{
    public function __construct(
        public string $table
    ) {}
}

// Using attributes
#[Entity(table: 'users')]
class User
{
    #[Column(name: 'id', type: 'uuid')]
    public string $id;

    #[Column(name: 'email', type: 'string')]
    public string $email;

    #[Column(name: 'name', nullable: true)]
    public ?string $name;
}

class UserController
{
    #[Route(path: '/users', method: 'GET')]
    public function index(): array
    {
        return $this->userService->getAll();
    }

    #[Route(path: '/users/{id}', method: 'GET')]
    public function show(string $id): User
    {
        return $this->userService->find($id);
    }
}

// Reading attributes
$reflection = new ReflectionClass(User::class);
$attributes = $reflection->getAttributes(Entity::class);

foreach ($attributes as $attribute) {
    $instance = $attribute->newInstance();
    echo $instance->table; // 'users'
}

Read the full file on GitHub · 690 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 690 lines · 6 tokens per session scan A ba1758e3d45a

Subscribe to this mod's changes

php is a skill published in the GitHub repository miles990/claude-software-skills (20 stars, last pushed 7mo ago), licensed MIT. It adds 6 tokens to every session and 3,414 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.