Skip to content

Adopt Pulsar incrementally

Migrate one entrypoint and its tested Domain behavior at a time while stock Laravel code coexists outside app/Pulsar. Each slice needs an executable checkpoint and a rollback path before the next slice begins.

Before you begin

Read existing application adoption and run the full reference suite as the checkpoint model.

Migrate a coordination slice

examples/reference-app/tests/Coordination/FinalizeOrderPaymentTest.php — A small executable checkpoint for Orders and Billing coordination.

php
<?php

namespace Tests\Coordination;

use App\Pulsar\Domain\Orders\Models\Order;
use App\Pulsar\Services\Client\Modules\Orders\UseCases\FinalizeOrderPayment;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class FinalizeOrderPaymentTest extends TestCase
{
    use RefreshDatabase;

    // #region cross-domain-coordination-test
    public function test_one_service_use_case_coordinates_orders_and_billing_without_calling_another_use_case(): void
    {
        $order = Order::query()->create(['tenant_id' => 'tenant-coordinate', 'reference' => 'coordinate-1', 'amount_cents' => 100, 'status' => 'pending']);
        app(FinalizeOrderPayment::class)->execute($order->id, 'coordinate-1');
        $this->assertSame('confirmed', $order->fresh()->status->value);
    }
    // #endregion
}

Verify and troubleshoot

Keep the old route available until the new boundary, authorization, tenant isolation, and rollback cases pass. Roll back by routing traffic to the proven old slice; do not promise an automated whole-application migration.