Skip to main content
Documentation Coming Soon - Comprehensive PHP SDK documentation is being prepared. In the meantime, use the API Reference and code examples throughout the guides.

Quick Start

Installation

composer require Intelliprint/intelliprint-php

Basic Usage

<?php
require_once 'vendor/autoload.php';

$ip = new \Intelliprint\IntelliPrint('your-api-key');

$printJob = $ip->prints->create([
    'testmode' => true,
    'content' => '<h1>Hello World!</h1>',
    'recipients' => [[
        'address' => [
            'name' => 'John Doe',
            'line' => '123 Main St, London',
            'postcode' => 'SW1A 1AA',
            'country' => 'GB'
        ]
    ]],
    'confirmed' => true
]);

echo "Print job created: {$printJob->id}\n";
?>

Resources

The PHP SDK provides access to all API resources:
  • $ip->prints - Print jobs
  • $ip->backgrounds - Letterheads and templates
  • $ip->mailingLists - Recipient lists
  • $ip->mailingListRecipients - Individual recipients

Guides & Examples

While the complete SDK reference is being prepared, explore these guides with PHP examples:

Configuration

$ip = new \Intelliprint\IntelliPrint('your-api-key', [
    'timeout' => 10,         // Request timeout (seconds) - default 30
    'maxRetries' => 3,       // Auto-retry failed requests - default 0
    'apiVersion' => 'v1'     // API version - default 'v1'
]);

Error Handling

try {
    $printJob = $ip->prints->create($params);
} catch (\Intelliprint\Exception\InvalidRequestException $e) {
    // Handle validation errors
    echo "Invalid request: {$e->getMessage()}\n";
    echo "Error code: {$e->getCode()}\n";
} catch (\Intelliprint\Exception\AuthenticationException $e) {
    // Handle auth errors
    echo "Authentication failed: {$e->getMessage()}\n";
} catch (\Intelliprint\Exception\IntelliPrintException $e) {
    // Handle other errors
    echo "Error: {$e->getMessage()}\n";
    echo "Type: {$e->getType()}\n";
    echo "Status code: {$e->getStatusCode()}\n";
}

File Uploads

// Upload PDF from file
$printJob = $ip->prints->create([
    'file' => fopen('./invoice.pdf', 'r'),
    'recipients' => [[
        'address' => [/* ... */]
    ]],
    'confirmed' => true
]);

// Upload from Base64
$base64PDF = base64_encode(file_get_contents('./invoice.pdf'));
$printJob = $ip->prints->create([
    'file' => [
        'base64' => $base64PDF,
        'filename' => 'invoice.pdf'
    ],
    'recipients' => [[
        'address' => [/* ... */]
    ]]
]);

PSR-7 HTTP Client Support

The SDK supports any PSR-7 compatible HTTP client:
use GuzzleHttp\Client as GuzzleClient;

$httpClient = new GuzzleClient([
    'timeout' => 10,
    'verify' => true
]);

$ip = new \Intelliprint\IntelliPrint('your-api-key', [
    'httpClient' => $httpClient
]);

Laravel Integration

// config/services.php
return [
    'intelliprint' => [
        'key' => env('INTELLIPRINT_API_KEY'),
    ],
];

// In your controller or service
use Intelliprint\IntelliPrint;

$ip = new IntelliPrint(config('services.intelliprint.key'));

$printJob = $ip->prints->create([
    'content' => view('emails.invoice', $data)->render(),
    'recipients' => [[
        'address' => $customer->address
    ]],
    'confirmed' => true
]);

Need Help?