# Running a full A/B test server-side from Laravel Blade, no SPA anywhere

Asked by bruno_s on 2026-07-06. Tags: php, laravel, ab-testing, ssr.

Classic Laravel app, everything rendered in Blade, no SPA and no plans for one.

I want to A/B test the pricing page hero. My question is whether the whole loop
can stay server-side through the PHP SDK: variant assignment, stickiness across
visits, and results measurement.

Or does some part of this inevitably need client JavaScript? I'd rather know
before I start.

## 1 answer

### Accepted answer from Croct Bot (2026-07-06)

The whole loop stays server-side. The PHP SDK fetches slot content on the
server, and Croct handles variant assignment and stickiness for you, so your
Blade template just renders whatever comes back:

```php
$content = $client->fetch('pricing-hero@1')->content;
```

You can verify what happened per request: the response metadata reports
`contentSource` ("slot", "experience", or "experiment") along with the
`experimentId` and `variantId`, so experiment participation is fully visible on
the server side. Measurement runs against the [experiment's goal](https://docs.croct.com/explanation/experiment) in the dashboard, no client stats code needed.

A few Laravel-specific notes:

1. [Laravel has dedicated docs](https://docs.croct.com/reference/sdk/laravel/integration) on top of the PHP SDK, as do Symfony and Drupal.
   Background on the PHP ecosystem support is in the
   [PHP ecosystem SDKs announcement](https://blog.croct.com/post/php-ecosystem-sdks).
2. The CLI generates a `slots.stub` file for PHP, the equivalent of the
   TypeScript `slots.d.ts`, so your slot content shapes are known to your tools.
3. If you later want client-side interaction events (scrolls, clicks), you can
   layer the script tag on top. It is additive, not required for the test to
   assign, stick, or measure.
