---
title: "Configuration"
description: "Set up the client with your API key, retries and timeouts."
url: "https://docs.goomzo.africa/docs/developers/php-sdk/configuration"
docs_index: /llms.txt
lastUpdated: 2026-11-12
section: "Get started"
---

> For an index of all documentation, see [/llms.txt](https://docs.goomzo.africa/llms.txt). Any page is also available as Markdown by adding .md to its URL.

# Configuration

> Set up the client with your API key, retries and timeouts.

The client reads its settings once, when you make it. Make one and share it across your app, such as a singleton in
your container.

## Options

```php
use Goomzo\Goomzo;

$goomzo = new Goomzo(
    apiKey: getenv('GOOMZO_API_KEY'),
    maxRetries: 2,
    timeout: 60.0,
);
```

| Option       | Description                                                                         | Default                     |
| ------------ | ----------------------------------------------------------------------------------- | --------------------------- |
| `apiKey`     | _string._ Your API key's secret.                                                    | `GOOMZO_API_KEY`            |
| `maxRetries` | _int._ How many times a failed request is tried again.                              | `2`                         |
| `timeout`    | _float._ Seconds to wait for each try.                                              | `60.0`                      |
| `baseUrl`    | _string._ Where the API is.                                                         | `https://api.goomzo.africa` |
| `httpClient` | _GuzzleHttp\ClientInterface._ Your own Guzzle client, such as for a proxy or tests. | A new one                   |

**Important:** Keep the API key on your server, such as in `.env`. Never put it in code that runs in a browser or an
app.

## In Laravel

```php title="app/Providers/AppServiceProvider.php"
use Goomzo\Goomzo;

public function register(): void
{
    $this->app->singleton(Goomzo::class, fn () => new Goomzo(apiKey: config('services.goomzo.key')));
}
```

## Idempotency keys

Every method that creates something takes `idempotencyKey`, so a retry from your side isn't done twice. Left out,
one is made for each call.

```php
$goomzo->messages->sendOne(
    ['to' => '+255712345678', 'channel' => 'sms', 'content' => ['text' => 'Your order is ready.']],
    idempotencyKey: 'order-1042-ready',
);
```

## API version

The SDK sends the `Goomzo-Version` it was written for, as `Goomzo::API_VERSION`.

## Next steps

- [Send messages](https://docs.goomzo.africa/docs/developers/php-sdk/messages?utm_source=llms&utm_medium=ai)
- [Errors](https://docs.goomzo.africa/docs/developers/php-sdk/errors?utm_source=llms&utm_medium=ai)

---

For an index of all available documentation, see [/llms.txt](https://docs.goomzo.africa/llms.txt)
