Skip to content

PHP SDK: anikeen/console beta ​

A PHP client for the Anikeen Console API, for Laravel 12+ (PHP 8.2+).

It lets a trusted app act in the Anikeen Console for its users, with the user's own Anikeen ID token: order products (the user confirms and pays on Anikeen ID), manage them, and learn about changes through webhooks. It is built on anikeen/id, which handles the login, the tokens and the webhook signatures.

Pre-release

The SDK is not released yet; the first release is planned as 0.1.0. It needs anikeen/id 3.6 and a Console release with app tokens, GET /app-team and app webhooks (on staging first). See the changelog.

How it works ​

text
your user ── login (Anikeen ID, scope console-containers) ──▶ your app stores the token pair
your app  ── AnikeenConsole::forUser($user)->appTeam() ──▶ the Console creates the user's team for your app
your app  ── ->orders($team)->create([...]) ──▶ open order with checkout_url
your user ── confirms on Anikeen ID ──▶ webhook order.completed, later product.ready
  • The Console accepts tokens of trusted apps only (otherwise 401 client_not_allowed).
  • Every app works in its own team of the user ("app team"), created on the first call. Other teams and products of the user are invisible to your app (404). The team and its products are read-only for the user in the Console; your app changes them.
  • The user does not need a Console account: it is created on the first call.
  • Orders are never charged directly: the order is open with a checkout_url, and the user confirms it on Anikeen ID.

The background is explained in Apps acting for users.

A first taste ​

php
use Anikeen\Console\Facades\AnikeenConsole;

$console = AnikeenConsole::forUser($user);   // the user's stored token, refreshed when needed

$team = $console->appTeam();                 // created on the first call
$plans = $console->catalog($team)->products('container');

$order = $console->orders($team)->create([
    ['family' => 'container', 'product_id' => $planId, 'attributes' => [
        'location_id' => 'bon1',
        'container_template_id' => $templateId,
        'vlan_id' => $vlanId,
    ]],
], ['tos_accepted' => true]);

return redirect($order->checkout_url);       // the user confirms (and pays) on Anikeen ID

What's covered ​

AreaSDKScope
App teamappTeam()any console-*
Catalogcatalog($team, $filters)any console-*
Ordersorders($team)any console-* to read; the family's full scope to order
Containerscontainers()console-containers (:read for reading)
Servers, domains, DNS zones, web hosting, load balancersnot in the SDK yet - use the REST API
Object storageordering onlyconsole-object-storage
WebhooksRoute::anikeenConsoleWebhooks() + Laravel events-
TestingAnikeenConsole::fake(), webhookRequest()-

Pages ​

Anikeen Console documentation