Development

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.

Latest release v0.1.0

Install

Pick whichever fits your project — they all reach the same skill.

  1. Claude Code via this marketplace
    /plugin install php-structured-edit@netresearch-claude-code-marketplace
  2. npx any Agent Skills CLI
    npx skills add https://github.com/netresearch/php-ast-edit-skill --skill php-structured-edit

    Universal Agent Skills CLI from skills.sh — works across Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI and 30+ more agents.

  3. composer require PHP project, as a package
    composer require netresearch/php-ast-edit-skill

    Requires netresearch/composer-agent-skill-plugin — resolves Agent Skills as Composer dependencies in PHP projects, auto-discovers skills, generates AGENTS.md.

  4. composer skills:add PHP project, direct source
    composer skills:add github:netresearch/php-ast-edit-skill

    Provided by netresearch/composer-agent-skill-plugin — pins skill repos directly without going through Packagist, locks them in composer.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.

Tags

  • development
  • quality-security