PHP Structured Edit
Edits PHP through its AST rather than regex, sed or patch, so a rename hits the identifier and not the same-named string literal beside it. Ten typed operations on nikic/php-parser, guarded by SHA-256 and expected node type, reparsed before write. Ships the php-ast-edit CLI.
Install
Pick whichever fits your project — they all reach the same skill.
-
Claude Code via this marketplace /plugin install php-structured-edit@netresearch-claude-code-marketplace -
npx any Agent Skills CLI npx skills add https://github.com/netresearch/php-ast-edit-skill --skill php-structured-editUniversal Agent Skills CLI from
skills.sh— works across Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI and 30+ more agents. -
composer require PHP project, as a package composer require netresearch/php-ast-edit-skillRequires
netresearch/composer-agent-skill-plugin— resolves Agent Skills as Composer dependencies in PHP projects, auto-discovers skills, generates AGENTS.md. -
composer skills:add PHP project, direct source composer skills:add github:netresearch/php-ast-edit-skillProvided by
netresearch/composer-agent-skill-plugin— pins skill repos directly without going through Packagist, locks them incomposer.skills.lock.
What you can do with it
- Edits PHP through its AST rather than regex, sed or patch, so a rename hits the identifier and not the same-named string literal beside it
- Ten typed operations on nikic/php-parser, guarded by SHA-256 and expected node type, reparsed before write
- Ships the php-ast-edit CLI
What you get back
- An inspect JSON document: file SHA-256 plus the AST ancestry at the requested position, smallest node first.
- A mutated PHP file, canonically printed and reparsed before the write.
- A structured failure (STALE_SOURCE, expectation mismatch, detached target) when a guard rejects the transaction — the file is left untouched.
What it expects in your project
- PHP 8.2+ with ext-json and ext-tokenizer.
- nikic/php-parser 5.8+ — via composer install, or bundled in the release PHAR.
- Write access to the target working tree. No external network access.