Search by

Official PHP SDK for the Max QR Code API (generate, dynamic codes, bulk jobs).

0.1.0 2026-11-17 02:11 UTC

This package is auto-updated.

Last update: 2026-11-17 02:17:46 UTC


README

Official PHP SDK for the Max QR Code API.

  • Static QR generate (PNG / SVG / PDF) + multipart logo upload
  • Dynamic short links (go.getmaxqr.com/r/:slug)
  • Bulk CSV/rows → poll → ZIP download

API keys (mq_live_…) are Business plan. Docs: getmaxqr.com/docs

Install

composer require getmaxqr/sdk

Requires PHP 8.1+.

Quickstart — generate a PNG

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

use GetMaxQr\Content;
use GetMaxQr\MaxQr;

$client = new MaxQr(['apiKey' => getenv('MAXQR_API_KEY')]);

$qr = $client->generate(Content::url('https://example.com'), [
    'format' => 'png',
    'style' => ['foreground' => '#111111', 'background' => '#ffffff', 'size' => 1024],
]);

file_put_contents('code.png', base64_decode($qr['data_base64']));

Generate with a center logo

Call the API host directly for large logos (not via a serverless proxy):

$qr = $client->generateWithLogo(
    Content::url('https://example.com'),
    [
        'data' => file_get_contents('./logo.png'),
        'filename' => 'logo.png',
        'mime' => 'image/png',
    ],
    ['logoScale' => 0.22, 'format' => 'png'],
);

file_put_contents('branded.png', base64_decode($qr['data_base64']));

Dynamic codes

$workspaceId = getenv('MAXQR_WORKSPACE_ID');
$result = $client->dynamic->create($workspaceId, [
    'name' => 'Table tent',
    'destination_url' => 'https://example.com/menu',
]);
$code = $result['code'];
echo $code['redirect_url'], PHP_EOL; // https://go.getmaxqr.com/r/…

$client->dynamic->update($workspaceId, $code['id'], [
    'destination_url' => 'https://example.com/menu-v2',
]);

Bulk job → ZIP

$workspaceId = getenv('MAXQR_WORKSPACE_ID');
$created = $client->bulk->create($workspaceId, [
    'content_type' => 'url',
    'format' => 'png',
    'rows' => [
        ['url' => 'https://example.com/a', 'name' => 'A'],
        ['url' => 'https://example.com/b', 'name' => 'B'],
    ],
]);
$jobId = $created['job']['id'];
$client->bulk->wait($workspaceId, $jobId);
file_put_contents('codes.zip', $client->bulk->downloadZip($workspaceId, $jobId));

Content helpers

use GetMaxQr\Content;

Content::url('https://example.com');
Content::text('Hello');
Content::wifi(['ssid' => 'Cafe', 'password' => 'secret', 'security' => 'WPA']);
Content::email(['to' => 'hi@example.com', 'subject' => 'Hi']);
Content::tel('+15550100');
Content::sms('+15550100', 'Hello');
Content::geo(1.5, -2.25);
Content::payment('https://buy.stripe.com/…');
Content::vcard(['first_name' => 'Ada', 'last_name' => 'Lovelace', 'email' => 'ada@example.com']);

Errors

use GetMaxQr\MaxQr;
use GetMaxQr\MaxQrException;

try {
    (new MaxQr(['apiKey' => '…']))->generateOptions();
} catch (MaxQrException $err) {
    // rate_limited | daily_quota | plan_forbidden | insufficient_scope | …
    error_log("{$err->errorCode} {$err->getStatus()} {$err->retryAfterSeconds} {$err->requestId}");
}

Options

Option Default Notes
apiKey — mq_live_… Business key
baseUrl https://api.getmaxqr.com/api/v1 Override for self-hosted / staging
timeout 60 Guzzle timeout (seconds)
client new Guzzle client Inject in tests

License

MIT