Atlas, the terminal-native AI coding agent, enables PHP developers in 2026 to systematically migrate an entire codebase off a deprecated function or module onto its replacement, ensuring no callsite is missed. It leverages your existing `composer.json` configuration, runs `PHPUnit` tests, and applies `PHP-CS-Fixer` formatting to guarantee a robust and compliant transition.
How Atlas enumerates all PHP API callsites for migration
In 2026, Atlas ensures a complete migration by front-loading the enumeration of every PHP callsite, combining precise language server data with robust keyword searches. It uses the `lsp` tool's `findReferences` operation to identify all declared usages and `grep` to catch dynamic or string-based calls, creating a comprehensive list.
Atlas begins a PHP API migration by building a comprehensive index of your codebase using tree-sitter, which understands AST declarations rather than blind line windows. This allows the `lsp` tool to accurately identify all references to a deprecated PHP symbol, whether it's a function, method, or class. For instance, if you're deprecating `MyOldClass::oldMethod()`, Atlas will use `atlas lsp findReferences MyOldOldClass::oldMethod` to get a complete set of callers from your PHP language server. Recognizing that PHP applications can also use dynamic calls or string-based references, Atlas then cross-checks this list with `atlas grep "MyOldClass::oldMethod"` to ensure no usage, even those not directly resolvable by the LSP, is overlooked. This dual-pronged approach guarantees that every potential callsite in your PHP project, across all `Composer` packages, is identified before any migration work begins. Each identified callsite is then converted into a tracked work item using `todowrite`, making partial progress visible and preventing any silent skips.
How Atlas migrates PHP callsites and verifies changes with PHPUnit
Atlas migrates each deprecated PHP callsite using context-anchored patches and immediately verifies the change by running `PHPUnit` tests. This ensures that every modification to your PHP code is functional and correct before marking the task complete, preventing regressions in 2026.
Once all deprecated PHP callsites are enumerated and tracked, Atlas proceeds with the migration of each individual call. For every `todowrite` entry, Atlas uses the `apply_patch` tool to modify the relevant PHP file. This tool is designed for precision; it seeks the hunk's context and `old_lines` and will throw a 'Failed to find expected lines' error rather than misapplying to a drifted file. This prevents accidental changes to the wrong part of your PHP codebase. After `apply_patch` modifies a PHP file, Atlas immediately runs the affected tests using the `bash` tool. For example, it might execute `atlas bash "vendor/bin/phpunit tests/MyAffectedClassTest.php"` to validate the change. Only once these `PHPUnit` tests pass for the modified file is the `todowrite` entry marked as completed. This iterative, test-driven approach ensures that each migration step is verified against your existing test suite, maintaining the integrity of your PHP application throughout the process.
How Atlas ensures safety and review for PHP code changes
Atlas prioritizes safety and developer review for all PHP code changes, providing unified diffs and requiring explicit approval before writing. It integrates with `git` to snapshot file changes, allowing for easy diffing, staging, and rollback of any modifications made to your PHP project in 2026.
Atlas is built with multiple layers of safety and review to protect your PHP codebase. Before any file edit is written, Atlas computes a unified diff for every proposed change and surfaces it for your approval. This means you always see exactly what modifications Atlas intends to make to your PHP files, such as `src/UserService.php` or `config/app.php`. Every Atlas tool call is permission-gated against allow, ask, and deny rules, giving you granular control over its actions. Furthermore, Atlas drafts a plan in a read-only plan agent and asks for your confirmation before switching to a build agent to execute changes. It also snapshots file changes as `git` patches, allowing edits to be easily diffed and rolled back if necessary. Atlas reads `git` branches, status, and diffs, and can stage and create commits on your behalf, streamlining the integration of these migrations into your existing PHP development workflow. This comprehensive review process ensures that all changes, from `Composer` dependencies to `PSR-12` formatting, are transparent and reversible.
How Atlas integrates with the PHP toolchain for direct migrations
Atlas deeply integrates with the standard PHP toolchain, understanding `composer.json` for namespaces and dependencies, and leveraging `PHPUnit` for testing. This allows Atlas to operate within your familiar development environment, applying `PSR-12` formatting with `PHP-CS-Fixer` and managing `Composer` packages effectively in 2026.
Atlas is designed to be a native extension of your PHP development environment. When you run Atlas in a project containing a `composer.json` file, it automatically reads your namespaces, autoload configuration, and dependencies. This understanding is crucial for accurately resolving symbols during enumeration and ensuring that `apply_patch` operations respect your project's structure. Atlas can be asked to add `PHPUnit` tests or apply `PSR-12` formatting using `PHP-CS-Fixer`, reviewing the diffs before committing. This means that not only does Atlas migrate deprecated API calls, but it can also help maintain code quality and consistency throughout the process. The ability to connect to Model Context Protocol servers and expose their tools further enhances its extensibility, allowing it to adapt to specific PHP project requirements. By working directly with `Composer`, `PHPUnit`, and `PHP-CS-Fixer`, Atlas ensures that migrations are not just functional, but also adhere to your project's established standards and practices.
Step by step
- 01Initialize Atlas in your PHP project by running `atlas run` in a directory containing a `composer.json` file, allowing it to read your namespaces and autoload configuration.
- 02Enumerate all direct calls to the deprecated PHP symbol using `atlas lsp findReferences 'MyDeprecatedNamespace\MyDeprecatedFunction'` to leverage the language server's precise data.
- 03Cross-check for dynamic or string-based usages of the deprecated PHP symbol with `atlas grep 'MyDeprecatedFunction'` to ensure no callsite is missed.
- 04Create a `todowrite` entry for each identified callsite, ensuring partial progress is visible and every migration task is tracked.
- 05For each `todowrite` entry, use `atlas apply_patch` to modify the PHP file, replacing the deprecated call with its modern equivalent. Review the unified diff presented by Atlas.
- 06After each file modification, run the affected `PHPUnit` tests using `atlas bash "vendor/bin/phpunit tests/MyAffectedFileTest.php"` to verify the change immediately.
- 07Mark the `todowrite` entry as completed only after the `PHPUnit` tests for that specific file pass, confirming the migration is successful and stable.
- 08Once all callsites are migrated, perform a final `atlas grep 'MyDeprecatedFunction'` to confirm zero remaining hits of the deprecated symbol in your PHP codebase.
- 09Delete the old PHP implementation of the deprecated function or module, ensuring a clean removal from your project.
- 10Optionally, use Atlas to apply `PSR-12` formatting with `PHP-CS-Fixer` across the modified files, reviewing the diff before committing.
Frequently asked questions
- How does Atlas ensure it finds all PHP calls to a deprecated function?
- Atlas combines `lsp findReferences` for precise, language-server-driven symbol resolution with `grep` for keyword-based searches. This dual approach catches both statically resolvable and dynamic or string-based usages within your PHP codebase, ensuring comprehensive enumeration.
- Can Atlas run my PHPUnit tests after making changes?
- Yes, Atlas uses its `bash` tool to execute your `PHPUnit` tests. After each file modification, Atlas can run commands like `vendor/bin/phpunit tests/MyModuleTest.php`, ensuring that every change is immediately validated against your existing test suite.
- How does Atlas handle PHP namespaces and Composer dependencies?
- Atlas reads your `composer.json` file to understand PHP namespaces, autoload configurations, and project dependencies. This context allows it to accurately resolve symbols and apply changes that respect your project's structure and `Composer` setup.
- What if Atlas tries to make a change to a PHP file that has been modified since enumeration?
- Atlas's `apply_patch` tool is designed for safety. It requires the exact context and `old_lines` to match. If a PHP file has drifted, `apply_patch` will throw a 'Failed to find expected lines' error, preventing misapplication and requiring manual review.
- Does Atlas help with PHP code formatting like PSR-12?
- Yes, Atlas can be instructed to apply `PSR-12` formatting using `PHP-CS-Fixer`. It will generate the necessary changes and present a diff for your review and approval, helping maintain code consistency alongside your migrations.
- How can I review and approve changes Atlas makes to my PHP code?
- Atlas provides a unified diff for every proposed file edit and requires explicit approval before writing. It also drafts plans in a read-only agent and asks for confirmation before executing, giving you full control over all modifications to your PHP project.
Try Atlas in your terminal
The terminal-native AI coding agent. Free core, single binary.
Install AtlasRelated guides
Migrate a Deprecated API Across Every Callsite with Atlas (2026 Workflow)
How to migrate a deprecated API across every callsite with Atlas in 2026: the lsp tool's findReferences enumerates callers, todowrite tracks them, apply_patch migrates each one.
Atlas for PHP in 2026
Atlas, the terminal-native AI coding agent, empowers PHP developers in 2026 with intelligent code understanding, secure workflows, and direct integration for Composer and PSR standards.
Run the PHP Test Suite and Triage Failures with Atlas in 2026
Streamline PHPUnit test failure triage in 2026 with Atlas. Quickly turn a wall of red output into a prioritized list of distinct root causes for your PHP codebase, integrating direct with Composer.
Debug a Single Failing Test in PHP with Atlas (2026)
Debug one failing PHPUnit test with Atlas in 2026: isolate it with the filter flag, walk the call path with the lsp tool, and fix the PHP code, not the assertion.
Audit a PHP Repository with Parallel Subagents in 2026
Sweep your entire PHP codebase for issues without context window limits. Atlas uses parallel subagents to audit Composer packages and PSR standards, integrating with PHPUnit and PHP-CS-Fixer.
Research a third-party API before integrating it in PHP with Atlas (2026)
Research a third-party API before writing PHP in 2026: Atlas uses websearch and webfetch behind permission prompts, then writes the client and PHPUnit tests.
Add a regression test for a bug fix in PHP with Atlas (2026)
Add a PHP regression test for a bug fix in 2026: Atlas proves the PHPUnit test fails red first, applies the fix with edit, and re-runs the same command to prove green.
Plan a multi-file change before editing in PHP with Atlas (2026)
Design a multi-file PHP change before any edit lands. Atlas's plan agent denies edit outside .atlas/plans/*.md, and plan_exit gates the handoff to the build agent.