# Review a Pull Request in PHP with Atlas in 2026

> Atlas helps PHP developers review pull requests by fetching the branch, reading full files, checking references with LSP, and running `PHPUnit` tests to ensure comprehensive code quality.

In 2026, Atlas empowers PHP developers to review pull requests by going beyond line-by-line diffs, integrating directly with your `composer.json` project and leveraging tools like `PHPUnit` and `PHP-CS-Fixer` to catch subtle bugs that a simple diff might miss. Atlas ensures a comprehensive review by understanding your PHP codebase's full context, not just the changed lines, and validating against your established toolchain.

## Key takeaways

- Atlas integrates deeply with your PHP project's `composer.json` for contextual understanding.
- Atlas runs your `PHPUnit` tests via the `bash` tool to validate PHP code changes automatically.
- The `lsp` tool's `findReferences` prevents breaking PHP API changes by checking all callers.
- Atlas provides a unified diff for every PHP file edit, requiring explicit approval before writing.
- Every Atlas tool call in PHP workflows is permission-gated, ensuring developer control and safety.
- Atlas can `grep` your PHP codebase for consistency, catching missed updates to constants or code patterns.

## How Atlas fetches and diffs PHP code for review

To initiate a PHP pull request review, Atlas first fetches the target branch and produces a comprehensive diff using its VCS layer, which exposes `git` data. This initial step ensures that all 10 changed files, from `src/Service/UserService.php` to `tests/Unit/UserServiceTest.php`, are accurately identified for deeper analysis, providing the foundation for a thorough review.

Atlas's core capability for pull request review in a PHP project begins with its robust version control system (VCS) integration. It uses the `bash` tool to interact with `git`, fetching the specific branch associated with the pull request. Once the branch is local, Atlas's VCS layer exposes `status`, `diff`, `diffRaw`, and `commits` over this `git` data. This allows Atlas to generate a precise, unified diff for every file edit, which is crucial for understanding the scope of changes. For instance, if a developer modifies `src/Model/Order.php` and `src/Repository/OrderRepository.php`, Atlas will present a clear, consolidated view of these changes, ensuring no modification goes unnoticed. This process mirrors how a careful human reviewer would start, by first understanding exactly what has changed across the entire PHP codebase.

## Reading full PHP files for complete context

A line-by-line diff often hides critical context, so Atlas uses its `read` tool to pull the full content of changed PHP files, not just the hunks. This approach ensures that surrounding code, such as a new method in `src/Util/Logger.php` or a modified class constant in `config/constants.php`, is visible, preventing bugs that a limited view might introduce in 2026.

Unlike traditional diff tools that only show the modified hunks, Atlas employs its `read` tool to retrieve the complete content of any changed PHP file. This is a fundamental step in catching bugs that a narrow, line-by-line review would miss. For example, if a developer adds a new method to `src/Service/PaymentGateway.php`, the diff might only show the new method's lines. However, reading the full file allows Atlas to see how this new method fits within the existing class structure, its dependencies, and potential interactions with other methods or properties. This full-file context is vital for PHP projects that adhere to PSR standards, where class structure, namespace declarations, and use statements are critical for code integrity. It allows Atlas to understand the architectural implications of a change, not just the textual ones.

## Validating PHP function signatures with LSP

To prevent breaking changes in a PHP application, Atlas leverages the `lsp` tool's `findReferences` operation for every modified function signature. If a developer alters a method signature in `src/Api/UserApi.php`, Atlas will check all 15 callers across the project, ensuring that no existing code is inadvertently broken by the change, a critical step for maintaining stability in 2026.

One of the most common sources of bugs in pull requests is a change to a function or method signature that breaks existing callers. Atlas addresses this directly using the Language Server Protocol (LSP) tool. For every changed function or method signature detected in a PHP file, Atlas automatically invokes the `lsp` tool's `findReferences` operation. This powerful capability allows Atlas to identify all locations in the codebase where that specific signature is called, even if those calling files were not part of the original diff. For instance, if a method `public function process(Order $order)` in `src/Processor/OrderProcessor.php` is changed to `public function process(Order $order, bool $async = false)`, Atlas will find every file that calls `process()` and flag potential issues where the new parameter is not provided or handled. This proactive check is indispensable for maintaining the integrity of a PHP application's API and preventing runtime errors.

## Ensuring PHP code consistency with grep

Atlas uses the `grep` tool to search for patterns that should have been updated but were overlooked, such as old constant names or stale copies of code. If a constant like `OLD_API_KEY` in `config/app.php` is replaced by `NEW_API_KEY`, Atlas will `grep` the entire PHP project to ensure all 7 references are updated, preventing hard-to-trace bugs from lingering legacy values.

Maintaining consistency across a large PHP codebase is challenging, especially when refactoring or introducing new features. Atlas employs the `grep` tool to proactively identify instances where changes might have been incomplete. This involves searching for specific patterns that indicate outdated code, such as old constant names, deprecated function calls, or stale copies of code that should have been updated or removed. For example, if a feature flag `FEATURE_X_ENABLED` is being removed, Atlas can `grep` the entire project to ensure all conditional blocks relying on this flag in files like `src/Controller/FeatureController.php` or `templates/feature_template.html.twig` are either updated or deleted. This systematic search helps catch 'silent' bugs where a change in one part of the system requires a corresponding update in another, often distant, part that a human reviewer might easily miss.

## Automated PHP testing with PHPUnit and reporting

After analyzing the code, Atlas runs the project's `PHPUnit` tests using the `bash` tool to validate the changes. For a typical PHP project, this might involve executing over 200 unit and integration tests, such as `vendor/bin/phpunit tests/Unit/` and `vendor/bin/phpunit tests/Integration/`. All findings, including test failures or warnings, are then reported as a `todowrite` list, ordered by severity for immediate action.

A critical component of any robust PHP pull request review is automated testing. Atlas integrates directly with your existing PHP testing infrastructure by using the `bash` tool to execute `PHPUnit` tests. This means Atlas can run your project's entire test suite, or specific subsets, just as a developer would from the terminal. For instance, it can execute `vendor/bin/phpunit tests/Feature/UserRegistrationTest.php` to validate a specific feature or `vendor/bin/phpunit --coverage-html build/coverage` to generate a coverage report. The results of these test runs, including any failures, errors, or warnings, are then compiled and presented to the developer as a `todowrite` list. This list is intelligently ordered by severity, ensuring that the most critical issues, such as failing `PHPUnit` assertions, are surfaced first, allowing for efficient debugging and resolution within the PHP development workflow.

## Atlas's safety and review workflow for PHP

Atlas prioritizes safety and transparency in every PHP workflow, ensuring that all tool calls are permission-gated against allow, ask, and deny rules. Before any changes are written to files like `src/Entity/Product.php`, Atlas computes a unified diff and surfaces it for approval, providing a 2-step verification process. This allows developers to review and roll back edits using `git` patches if necessary.

Atlas is designed with a strong emphasis on developer control and safety, particularly crucial when making changes to a PHP codebase. Every Atlas tool call, whether it's `bash` for running `Composer` commands or `lsp` for code analysis, is permission-gated. This means you define `allow`, `ask`, or `deny` rules, ensuring Atlas only performs actions you explicitly permit. Before Atlas writes any modifications to your PHP files, it drafts a plan in a read-only plan agent and asks for approval before switching to a build agent. Furthermore, for every proposed file edit, Atlas computes a unified diff and presents it for your approval. This allows you to meticulously review exactly what changes Atlas intends to make to files like `public/index.php` or `config/services.yaml`. If an edit is not satisfactory, Atlas snapshots file changes as `git` patches, enabling easy diffing and rolling back of edits, providing a robust safety net for your PHP development.

## Steps

1. Fetch the pull request branch and produce a comprehensive diff using Atlas's VCS layer and the `bash` tool, identifying all changed PHP files like `src/Controller/UserController.php`.
2. Read the full content of all changed PHP files with the Atlas `read` tool, ensuring complete context beyond just the diff hunks, for example, `src/Service/AuthService.php`.
3. For every changed PHP function or method signature, use the Atlas `lsp` tool's `findReferences` operation to check all callers across the codebase, preventing breaking API changes.
4. Utilize the Atlas `grep` tool to search the PHP project for patterns that should have been updated but were missed, such as old constant names in `config/parameters.php` or stale code copies.
5. Run the project's `PHPUnit` tests via the Atlas `bash` tool, executing commands like `vendor/bin/phpunit tests/Unit/` to validate the functional integrity of the PHP changes.
6. Report all findings, including `PHPUnit` failures, `grep` matches, and `lsp` warnings, as a `todowrite` list, ordered by severity for efficient review and resolution.
7. Review Atlas's proposed edits as unified diffs for files like `src/Entity/Post.php` and approve them before Atlas writes any changes to your PHP codebase.

## FAQ

### How does Atlas understand my PHP project structure and dependencies?

Atlas understands your PHP project by reading your `composer.json` file, which defines your namespaces, autoload configuration, and dependencies. This allows Atlas to accurately navigate your codebase, whether it's a complex Symfony application or a custom Composer package, providing relevant context for its operations.

### Can Atlas run my `PHPUnit` tests as part of a pull request review?

Yes, Atlas can run your `PHPUnit` tests. It uses the `bash` tool to execute your `vendor/bin/phpunit` commands, just as you would from your terminal. This ensures that any changes introduced in the pull request are validated against your existing test suite, and any failures are reported directly to you.

### How does Atlas ensure it doesn't break existing PHP code when reviewing a PR?

Atlas employs several safety mechanisms. It uses the `lsp` tool's `findReferences` to check for breaking changes to PHP function signatures. Additionally, Atlas drafts a plan in a read-only agent and presents a unified diff for every proposed file edit, such as to `src/Model/User.php`, for your explicit approval before writing any changes, allowing you to roll back edits if needed.

### What PHP formatting tools does Atlas support for code consistency?

Atlas supports standard PHP formatting tools like `PHP-CS-Fixer`. You can ask Atlas to apply PSR-12 formatting, for example, and it will generate a diff of the proposed changes to your PHP files, such as `src/Service/FormatterService.php`, for your review and approval.

### Is my PHP code sent to third-party servers for indexing or analysis by Atlas?

No, Atlas can build its code index with local Ollama embeddings, keeping your PHP code off third-party servers. This ensures that your proprietary codebase, including sensitive files like `config/database.php`, remains secure and private within your local development environment.

### Can Atlas help me find old constant names or feature flags in my PHP project?

Absolutely. Atlas uses the `grep` tool to search your entire PHP project for specific patterns. This is highly effective for finding old constant names, deprecated function calls, or lingering feature flags that should have been updated or removed, ensuring your codebase remains clean and consistent.

### How does Atlas handle parallel tasks during a PHP pull request review?

Atlas is designed to fan out work to subagents that can run in the foreground or in parallel background sessions. This allows it to efficiently perform multiple tasks simultaneously during a PHP pull request review, such as running `PHPUnit` tests while also performing `lsp` checks, speeding up the overall review process.

---

Canonical HTML: https://runatlas.sh/resources/stacks/review-a-pull-request-in-php
Source of truth: aeo_pages row `/resources/stacks/review-a-pull-request-in-php` (segment: Stacks) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
