dhpk-php-modern-pro

dhpk-php-modern-pro is a skill for Claude Code from hmj1026/dhpk. It costs 58 tokens per session (2,342 once invoked), scanned A, original, MIT.

Guidance for writing PHP 7.4 through 8.x code and libraries that support more than one PHP version. It covers language features, public interfaces, and Composer version requirements.

In plain words
What is it for?
Use it when designing a public PHP API, choosing modern PHP patterns, adding version-specific compatibility code, or setting Composer requirements.
Why use it?
It helps avoid using syntax or package constraints that break supported PHP versions.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dhpk plugin — 65 skills, 31 commands, 37 agents, 4 hooks shipped together

Good fit Use it when designing a public PHP API, choosing modern PHP patterns, adding version-specific compatibility code, or setting Composer requirements.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hmj1026/dhpk/dhpk-php-modern-pro
View source ↗ hmj1026/dhpk
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 hmj1026/dhpk --skill dhpk-php-modern-pro
Clone the repo
git clone --depth 1 https://github.com/hmj1026/dhpk

Made for: Claude Code.

Or install dhpk, the plugin that ships this one along with the rest of its 65 skills, 31 commands, 37 agents, 4 hooks.

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 dhpk-php-modern-pro

README.md
[![agentmods](https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-php-modern-pro/github.svg)](https://agentmods.dev/skills/hmj1026/dhpk/dhpk-php-modern-pro)
Your own site
<a href="https://agentmods.dev/skills/hmj1026/dhpk/dhpk-php-modern-pro"><img src="https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-php-modern-pro/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 dhpk-php-modern-pro

Your own site · 80×15
<a href="https://agentmods.dev/skills/hmj1026/dhpk/dhpk-php-modern-pro"><img src="https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-php-modern-pro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,342 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.
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.00058 $0.02342
Opus 5 $0.00029 $0.01171
Sonnet 5 $0.00012 $0.00468
Haiku 4.5 $0.00006 $0.00234

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

Security

Grade A, and why

dhpk-php-modern-pro 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 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.

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.

generated/claude-profiles/compat-v1/package/skills/dhpk-php-modern-pro/SKILL.md · 237 lines

How it starts

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

PHP modern pro — 7.4 baseline + dual-floor library design

This skill is the counterpart to dhpk-php-runtime-router (which assumes PHP 5.6 and forbids ≥7.0 syntax). Load it when working on code that targets PHP 7.4 or a library that intentionally spans 7.x→8.x.

modules/php-7.4/references/static-checks.md is the always-loaded index into the tooling tier (php-cs-fixer + phpstan/psalm). This skill is the language & packaging companion — load when designing API shape, picking idioms, or reviewing composer constraints.

Rule of thumb: dhpk-php-runtime-router is for legacy monoliths frozen at 5.6. dhpk-php-modern-pro is for greenfield 7.4+ code and any composer package that ships against a version range.


7.4 baseline — prefer these idioms

Typed properties

final class UserId
{
    private int $value;

    public function __construct(int $value)
    {
        $this->value = $value;
    }
}
  • Always type properties. Drop PHPDoc @var once the property is typed unless the type is a narrowed version of the declared type (e.g. array<string, User> on top of array).
  • Prefer final on value objects and on classes that aren't designed for inheritance. Subclasses you can't anticipate are subclasses you'll regret.

Arrow functions

$ids = array_map(fn(User $u): int => $u->id(), $users);
  • Use for one-expression callbacks. They auto-capture by value.
  • Don't reach for function (…) use (…) {} unless you need a multi-line body. Arrow fns make array_* and Collection::map/filter callsites read top-to-bottom.

Null-coalesce assignment

$config['timeout'] ??= 30;
  • Replaces $config['timeout'] = $config['timeout'] ?? 30;.
  • Works on array offsets, object properties, and plain variables.

Spread in arrays

$base = ['a', 'b'];
$all  = [...$base, 'c', 'd'];
  • Replaces array_merge for plain numeric arrays. Not safe for string-keyed arrays in 7.4string keys throw; only numeric keys spread. (PHP 8.1+ lifts this restriction.)

Read the full file on GitHub · 237 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. 4d ago First seen · 237 lines · 58 tokens per session scan A 1fe349af2da4

Subscribe to this mod's changes

dhpk-php-modern-pro is a skill published in the GitHub repository hmj1026/dhpk (2 stars, last pushed today), licensed MIT. It adds 58 tokens to every session and 2,342 once invoked, about $0.0003 per session on Opus 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-05.

Related

Other skills, from other repositories

craftcms

Craft CMS 5 plugin and module development — extending Craft with PHP. Covers elements, element queries, services, models, records, controllers, migrations, queue jobs, console commands, field types, native fields, events, behaviors, Twig extensions, widgets, filesystems, permissions, project config, GraphQL, testing…

michtio/craftcms-claude-skills · 327 tokens

craft-php-guidelines

Craft CMS 5 PHP coding standards and conventions. ALWAYS load when writing, editing, reviewing, or discussing any PHP in a Craft plugin or module — even small edits. Also when running ECS, PHPStan, or scaffolding with ddev craft make. Covers: PHPDoc blocks (@author, @since, @throws chains), section headers…

michtio/craftcms-claude-skills · 336 tokens

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

symfony:daily-workflow

Daily development workflow for Symfony projects including common tasks, debugging, and productivity tips.

dev-toolings/superpowers-symfony · 22 tokens

solid-php

Use when applying SOLID principles to Laravel 13 / PHP 8.3+ code — file size limits, interface placement, or PHPDoc enforcement.

fusengine/agents · 35 tokens

laravel-migrations

Use when designing a database schema or managing Laravel 13 migrations — Schema Builder, columns, indexes, foreign keys, or seeders.

fusengine/agents · 32 tokens