# PHP SDK

> AI agents: search and read all Moov docs with the docs MCP server at https://docs.moov.io/mcp (no API key). Setup: https://docs.moov.io/guides/developer-tools/mcp-ai/docs-mcp/index.md

Repository: https://github.com/moovfinancial/moov-php
Current release for API v2026.07.00: v26.7.9

Pin the package version you install so your integration stays on the API version it was built against. API versions: https://docs.moov.io/api-versions.json

## SDK Installation

The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:
```bash
composer require "moov/moov-php"
```

## SDK Example Usage

### Example

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Components\CreateAccount(
    accountType: Components\CreateAccountType::Business,
    profile: new Components\CreateProfile(
        business: new Components\CreateBusinessProfile(
            legalBusinessName: 'Whole Body Fitness LLC',
        ),
    ),
);

$response = $sdk->accounts->create(
    request: $request
);

if ($response->account !== null) {
    // handle response
}
```

## Authentication

### Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name                      | Type | Scheme     |
| ------------------------- | ---- | ---------- |
| `username`<br/>`password` | http | HTTP Basic |

You can set the security parameters through the `setSecurity` function on the `SDKBuilder` when initializing the SDK. For example:
```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;

$sdk = MoovPhp\Moov::builder()
    ->setSecurity(
        new Components\Security(
            username: '',
            password: '',
        )
    )
    ->build();

$request = new Components\CreateAccount(
    accountType: Components\CreateAccountType::Business,
    profile: new Components\CreateProfile(
        business: new Components\CreateBusinessProfile(
            legalBusinessName: 'Whole Body Fitness LLC',
        ),
    ),
);

$response = $sdk->accounts->create(
    request: $request
);

if ($response->account !== null) {
    // handle response
}
```

### Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:
```php
declare(strict_types=1);

require 'vendor/autoload.php';

use Moov\MoovPhp;
use Moov\MoovPhp\Models\Components;
use Moov\MoovPhp\Models\Operations;

$sdk = MoovPhp\Moov::builder()->build();

$avatarUploadRequest = new Components\AvatarUploadRequest(
    file: new Components\AvatarUploadRequestFile(
        fileName: 'example.file',
        content: file_get_contents('example.file');,
    ),
);
$requestSecurity = new Operations\UploadAvatarSecurity(
    username: '',
);

$response = $sdk->avatars->upload(
    security: $requestSecurity,
    uniqueID: '<id>',
    avatarUploadRequest: $avatarUploadRequest

);

if ($response->statusCode === 200) {
    // handle response
}
```

Full README: https://github.com/moovfinancial/moov-php
