# Laravel SDK (https://docs.getaviato.com/integrations/laravel)



The Laravel SDK requires PHP 8.3 or newer and Laravel 12 or 13. Its package name is `aviato/laravel`; use a published release compatible with your agent. The implementation lives in [packages/sdk-laravel](https://github.com/getaviato/aviato/tree/master/packages/sdk-laravel).

## Configure your application [#configure-your-application]

With the package installed, `php artisan aviato:install` publishes its configuration and downloads the agent binary. Set the project connection values in your deployment environment:

```dotenv
AVIATO_CONTROL_PLANE_URL=https://api.getaviato.com
AVIATO_AGENT_TOKEN=replace-with-your-project-token
AVIATO_PLUGIN_SECRET=replace-with-your-standard-webhooks-secret
AVIATO_PLUGIN_URL=https://your-app.example.com/aviato
```

The database URL defaults to your Laravel database connection. Override it with `AVIATO_DATABASE_URL` when the agent should use a different database account.

## Register an action [#register-an-action]

Register definitions from a service provider's `boot` method:

```php
use Aviato\Laravel\Context\ActionContext;
use Aviato\Laravel\Facades\Aviato;

Aviato::action('customers', 'Confirm selection')
    ->single()
    ->execute(function (ActionContext $context) {
        $customer = $context->records()[0];
        return $context->success('Customer selected');
    });
```

Plugin endpoints are outside Laravel's browser-session middleware. Requests are authenticated using their signatures, not a session cookie or CSRF token.

## Run and test [#run-and-test]

`php artisan aviato:serve` runs the downloaded agent with your configured connection and plugin settings. Use a process supervisor and durable agent data directory in production.

`Aviato::fake()` provides handler tests and an in-memory Data API. The [Laravel fixture](https://github.com/getaviato/aviato/tree/master/packages/fixtures/laravel) shows a working application; the [SDK README](https://github.com/getaviato/aviato/blob/master/packages/sdk-laravel/README.md) covers testing, relation discovery, and advanced registrations.
