All jobs

Review Pull Requests on a Laravel Livewire App

Yes. For each pull request the agent runs Pint, PHPStan and the tests on base and head, reads every changed Livewire component and posts one review.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent first learns what the repository already enforces. In an app like laravel/livewire-starter-kit, the workflow in .github/workflows/tests.yml runs composer setup and then composer ci:check, which is composer test: Pint with --test, phpstan analyse at level 7 and php artisan test. The agent checks out the base branch in a second directory, makes sure PHP 8.3, Composer and Node 22 are present, and runs that script on both sides. The review reports the difference, so a failure that was already on the base is listed apart from one the pull request introduces.

Then it reads what those checks do not. phpstan.neon analyses app/, bootstrap/app.php, config/, database/ and routes/. The Livewire 4 components are single files under resources/views/pages, a PHP class and a Blade template in one .blade.php, and that folder is not in the list. A changed component passes static analysis without being looked at, so the agent reads each one line by line. That is where most of a Livewire review happens.

It reads a component the way a browser can use it. Every public property can be written from the client and every public method can be called from it. The existing code shows the conventions to hold a change to: ids and flags the client must not choose carry #[Locked], as deletingPasskeyId does on the security page; helpers that are not actions are private, as loadSetupData is; records are found through the signed-in user's relation, auth()->user()->passkeys()->findOrFail(...), never by a bare id; and validation rules come from the traits in app/Concerns, which the registration action shares. A diff that adds a public $userId, a public helper or an inline copy of the email rules is a finding with its line.

It checks the edges around the component as well. A new Route::livewire line in routes/settings.php belongs in the auth group or the auth and verified group, and the security page also sits behind password.confirm. The User model lists its fillable columns in a #[Fillable] attribute and the profile page saves with $user->fill($validated), so a new column that is both validated and fillable becomes user-editable. A changed action with no change to a Livewire::test case is noted. The agent pushes nothing and posts one review.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Review this pull request to our Laravel Livewire app. Read composer.json, phpunit.xml, phpstan.neon, pint.json, .github/workflows/tests.yml, routes/web.php, routes/settings.php, app/Models/User.php and the traits under app/Concerns first, and note which folders PHPStan analyses. Make sure PHP 8.3, Composer and Node 22 are installed. Check out the base branch in a second directory and run composer setup and composer test on both base and head; report only what the pull request changes, and list failures that already exist on the base separately. Then read the diff. For every changed Livewire component, single-file under resources/views/pages or a class under app/Livewire, list its public properties and public methods and flag: a public property that holds an id, a role, a price or a permission flag without #[Locked]; a public method that is a helper and not an action; a record looked up by an id from the client without going through the signed-in user's relation or a policy; validation rules written inline where a trait in app/Concerns already has them; a property saved without being validated; a redirect built from client input; and a secret, token or recovery code placed in a public property. Outside components, flag: a new route in the wrong middleware group or without password.confirm where it changes credentials; a column added to the User model's Fillable attribute; a migration without a matching factory state; a rate limiter removed or widened in FortifyServiceProvider; a removed data-test attribute; and a changed action with no changed Livewire::test case. Post one review on the pull request with the command differences first, then findings by file and line, each with one sentence of reason. Do not push commits.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app/pull/42"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

One review on the pull request. It opens with a small table of the three steps of composer test, their result on base and on head, and one line on what changed: a Pint violation the diff adds, a PHPStan error in a new action class, a test that now fails. A pull request that only edits a Blade template gets a short review saying all three are unchanged and naming the components it read.

Findings follow by file and line. Each says what the browser could do: set $teamId to another team's id before calling save, call a public loadInvoices directly, submit a field that fill will store. Where a finding rests on a convention, the review quotes the existing line that sets it, such as the #[Locked] on the passkey id or the findOrFail through the user's relation, so the author sees the pattern and not just an opinion. The full output of every command is in the session's transcript at GET /o/{org}/sessions/{id}/messages.

The review leaves decisions to the people who own the app. Whether a new settings page needs a verified email, whether a column should be user-editable and whether PHPStan should start reading resources/views are raised as questions. The agent says plainly what it did not do: it did not open the pages in a browser, so Alpine behaviour and Flux styling are unreviewed unless the prompt asks for a browser pass.

Run it on every pull request

In the Project that holds the repository, create an automation with this prompt, read-only switched on, and a github trigger on pull_request.opened and pull_request.synchronize with your default branch in branch_patterns. A review starts when a pull request opens and again on each push to it. The trigger puts the pull request after the prompt and fills in no placeholder, and with read-only on the run can read the repository and comment but cannot push.

The trigger fires for pull requests by an owner, member or collaborator and never for forks or bot senders. That suits a product team, where everyone who opens a pull request is a member. Dependency bots are the gap: a Dependabot pull request, like the weekly github-actions group this kit's dependabot.yml asks for, starts no review. To review one, start a run by hand with its URL in resources, as this page's request does.

The use case this job follows, with its automation and trigger: Review every pull request.

Why run it on Rush?

Livewire moves the boundary between client and server into a PHP class, and the tools a Laravel team already runs do not all follow it there. Pint formats the file. PHPStan, in this configuration, never opens it. The tests cover the actions someone thought to test. What is left is a reviewer reading each public property and asking whether a user should be able to change it, on every pull request, without getting tired of the question. An agent with the repository checked out twice in its own sandbox does that reading each time and backs it with the same three commands CI runs.

Running base and head side by side is the other half. On a laptop it means stashing work, switching branches and rebuilding assets, so reviewers skip it and trust the status check. In a Rush sandbox both checkouts are built fresh for each pull request and several pull requests are reviewed at once, each in a separate machine, with the commands and their output kept in the run's record.

Frequently asked questions

Why does a public property matter in review?

Because the browser can set it. Livewire sends public properties to the client and accepts updates to them on the next request, so a public $orderId is an input field whether or not the template shows one. Marking it #[Locked] makes Livewire refuse the update, and looking the record up through the signed-in user's relation covers the case where it is not locked.

PHPStan passes on our pull requests. Is that not enough?

It depends on what PHPStan reads. In the starter kit its paths list leaves out resources/views, where the single-file components live, so their classes are never analysed. The review reads them directly and raises the configuration as a question once, without editing phpstan.neon.

Does it run the test suite or only read the diff?

It runs it, on both branches. phpunit.xml uses in-memory SQLite with array sessions and mail, so the suite needs no database server or external service. The review states the result for each side and names any test that fails only on head.

Can it review a pull request from a fork?

A github trigger does not fire for one. A maintainer pushes the contributor's commits to a branch in the repository and opens a pull request from that branch, which fires the trigger, or starts a run by hand with that new pull request's URL in resources.

Will it approve the pull request?

The prompt decides. As written it posts findings and command results and leaves approval to a person. If you want a newly failing test or an id without #[Locked] to block merging, say so in the prompt and make the review required in your branch rules.

More Livewire jobs

The same job on other stacks

Keep reading