---
title: "PHP SDK"
description: "Install, use, and observe the official Inttegro SDK for PHP."
canonical: "https://studio.inttegro.com/sdks/php"
format: inttegro-machine-docs/v1
language: "Java"
sdk_version: "v8.3.0"
reader_profile: optional
reader_manifest: "https://studio.inttegro.com/machine/java/readers/index.json"
reader_identification: "Optional: declare your client only if known and your current-session capabilities; use reader_manifest for supplemental recommendations."
preamble_estimated_tokens: 564
model_token_report: "https://studio.inttegro.com/machine/token-report.json"
preamble_questions: 5
preamble_source: "general"
recommended_mcp_tools: ["get_integration_guide","check_integration_readiness"]
estimated_tokens: 1895
token_estimate_method: "utf8_bytes_divided_by_4"
---

## Machine preamble

**Summary:** Install, use, and observe the official Inttegro SDK for PHP. This Java representation uses the selected SDK's native names wherever Studio has a verified mapping.

### Five questions

#### Q1. When should the reader use PHP SDK?

Use this SDK guide when the selected runtime or framework matches the application being built.

#### Q2. What is authoritative on this page?

Use this page for orientation; follow its canonical SDK, guide, API, or MCP links for exact contracts.

#### Q3. What page-specific constraint matters most?

Use the current documented SDK version and native public API; do not invent members from JSON names or another language.

#### Q4. Can Inttegro MCP materially help with this task?

Yes, when the reader has an authenticated MCP connection and the task needs live context, guided planning, or a supported operation. The strongest matches are `get_integration_guide`, `check_integration_readiness`; their exact roles and boundaries are listed below.

#### Q5. How should the reader verify the answer and continue?

Install the documented version, compile or type-check the smallest example, run it against a disposable application, and verify the resulting resource through its canonical lookup. Continue with [Choose an API resource](https://studio.inttegro.com/machine/java/api.md) and [Laravel storefront demo](https://studio.inttegro.com/machine/java/demos/laravel.md) when those concerns enter scope.

### Recommended MCP assistance

Use these through an authenticated Inttegro MCP connection. This document remains the contract source.

- [`get_integration_guide`](https://studio.inttegro.com/machine/java/inttegro-mcp/tools.md#get_integration_guide) — read-only integration guidance. Returns a focused implementation sequence and canonical Studio links for authentication, checkout, orders, catalog, messaging, idempotency, or testing.
- [`check_integration_readiness`](https://studio.inttegro.com/machine/java/inttegro-mcp/tools.md#check_integration_readiness) — read-only integration guidance. Audits platform secret storage, server-runtime compatibility, idempotency, errors, state verification, checkout returns, and messaging consent without receiving source code or credentials.

## Document content

# Inttegro PHP SDK

The [Inttegro PHP SDK](https://packagist.org/packages/inttegro/sdk) builds
server-side integrations with native request arrays, singular resource
namespaces, backed enums, and immutable typed domain objects returned by
resource operations.

:::tip Start with MCP

Before writing SDK code, [connect your MCP client](https://studio.inttegro.com/machine/java/inttegro-mcp/connect.md) and ask
MCP to [design the integration](https://studio.inttegro.com/machine/java/inttegro-mcp/design-integration.md) for
your PHP application. Use the resulting implementation and test plan to guide
the code you write with this SDK.

:::

## Install

The SDK requires [PHP 8.1 or newer](https://www.php.net/supported-versions.php).
Install the package with [Composer](https://getcomposer.org/doc/03-cli.md#require-r):

```bash
composer require inttegro/sdk
```

:::warning Keep the SDK on the server

[Load the secret API key securely](https://studio.inttegro.com/machine/java/api/authentication.md#store-credentials-safely)
from server-side code. Never place the key in browser code, a mobile
application, or source control.

:::

## Create a client

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Inttegro\Client;

$inttegro = new Client(getenv('INTTEGRO_API_KEY'));
```

Returned resources support property access, `ArrayAccess`, `toArray()`, and
JSON serialization without exposing HTTP response envelopes.

## Naming conventions

Use `camelCase` for PHP identifiers and typed domain properties. Native request
arrays, `ArrayAccess`, `toArray()`, and JSON use the API's documented
`snake_case` field names:

```php
$paymentId = $transaction->paymentId;

$order = $inttegro->orders->pay([
    'order_id' => $orderId,
    'payment_method_id' => $paymentMethodId,
]);
```

Only declared `camelCase` properties are exposed as object properties. Use
mapping access such as `$transaction['payment_id']` when working with a dynamic
wire-field name.

## Navigate typed resources

The main object has the same name as its singular namespace. Related types stay
beside it, so autocomplete remains focused on the resource at hand:

```php
use Inttegro\Payment\Payment;
use Inttegro\Payment\Status;
use Inttegro\Product\Product;
use Inttegro\Product\Type;

$product = Product::fromArray($productData);

if ($product->type === Type::Digital->value && $product->isPublished()) {
    // Offer the product for sale.
}

/** @var Payment $payment */
$payment = $order->payment;

if ($payment->status === Status::RequiresAction->value) {
    $nextAction = $payment->requiredAction();
}
```

Question methods such as `isPaid()`, `requiresAction()`, `isTerminal()`,
`isPublished()`, and `isReusable()` inspect the current object only. They never
make an API request.

## See it in a complete app

The [Laravel storefront demo](https://studio.inttegro.com/machine/java/demos/laravel.md) follows a shopper from choosing a
product through a hosted checkout. Follow the guide to see how Laravel keeps
the cart, price, and API key on the server while the PHP SDK creates the
payable order.

## Observability

The global [OpenTelemetry provider](https://opentelemetry.io/docs/languages/php/)
is used automatically. You can instead inject the provider and propagator owned
by your application:

```php
$inttegro = new Client(
    apiKey: getenv('INTTEGRO_API_KEY'),
    tracerProvider: $tracerProvider,
    propagator: $propagator,
);
```

> Server Sdk Observability is interactive content. Use the canonical page to view it.

### Report SDK failures

Pass an application-owned callback to receive one immutable, typed report after
an SDK operation finally fails:

```php
<?php

use Inttegro\Client;
use Inttegro\ErrorReport;

$enqueueError = static function (ErrorReport $report): void {
    $payload = json_encode($report);
    unset($payload); // Forward the payload to your collector or queue.
};

$inttegro = new Client(
    apiKey: getenv('INTTEGRO_API_KEY'),
    errorReporter: $enqueueError,
);
```

> Server Sdk Error Reporting is interactive content. Use the canonical page to view it.

## Continue

- [Browse the generated API reference](https://php.inttegro.dev/v12.0.0/)
- [View the package on Packagist](https://packagist.org/packages/inttegro/sdk)
- [Browse the source and releases](https://github.com/inttegro/inttegro-sdk-php)
- [Run the Laravel storefront](https://studio.inttegro.com/machine/java/demos/laravel.md)
- [Choose an API resource](https://studio.inttegro.com/machine/java/api.md)
