PHP Structured Edit
Edit PHP methods, parameters and expressions with named selectors, typed operations and SHA-256 guards. Supports multi-file batches, format-preserving output and optional canonical printing. Review diffs and run lint/project tests; syntax checks do not prove behavior.
Install
Choose a supported route below. Package contents, agent registration and runtime dependencies can differ between installers.
-
Claude Code via this marketplace /plugin install php-structured-edit@netresearch-claude-code-marketplaceFirst add the marketplace once in Claude Code:
/plugin marketplace add netresearch/claude-code-marketplace. Registers the plugin's agent instructions. Set up the PHP editing engine separately:engine installation guideRequires PHP 8.2+, JSON and tokenizer. A source plugin install does not install Composer dependencies. -
npx interactive skill selection npx skills add https://github.com/netresearch/php-ast-edit-skillRequires Node.js 22.20+. Run from the target project, then choose the source skills and agents in the installer. Installs skill instructions; the PHP engine is a separate component:
engine installation guideCheck the installed wrapper and engine before assigning an editing task. -
composer require PHP project, as a package composer require --dev --no-plugins --no-scripts netresearch/php-ast-edit-skill:^2.0Installs the published 2.x PHP engine with Composer plugins and project scripts disabled. Agent instructions are registered separately; see
source installation guideRequires Composer 2.2+ and PHP 8.2+ with JSON and tokenizer. Commit the consuming project's composer.lock for reproducible resolution. -
composer skills:add PHP project, direct source composer skills:add netresearch/php-ast-edit-skillInstall and activate netresearch/composer-agent-skill-plugin first; approve the selected source's skill registration. Requires the Composer skill installer and registers instructions, without installing the engine's PHP dependencies:
engine installation guideSet up and verify the engine separately.
What you can do with it
- Add a member, parameter, type, attribute, statement, or argument without locating text ranges.
- Edit several symbols or files with shared preconditions and one CLI startup.
- Change a PHP string literal without modifying neighboring PHP syntax.
- Reject stale source, ambiguous targets, malformed snippets, and recognized unsafe rename cases before writing.
- Create and delete files through the same transaction API.
What you get back
- A guarded source edit, a measured diff, operation effects, accumulated warnings, and separate parser, lint, and project-check statuses. Inspect requests return node ancestry and the source hash; rejected requests return machine-readable errors.
What it expects in your project
- Provide the intended change and any source snapshot used to select targets.
renameaccepts a method symbol; other operations use file paths and selectors or structural refs. The engine requires a writable working tree and the local dependencies above. Project formatting and verification commands are optional configuration.