PHP

Use the Cells HTTP API from PHP. No published Composer package exists yet.

Note
No Packagist package has been published. Use the REST API directly with cURL or Guzzle, or generate a typed client from the OpenAPI spec.

HTTP example

PHP (cURL)
<?php
$projectId = getenv('CELLS_PROJECT_ID');
$apiKey    = getenv('CELLS_API_KEY');

$ch = curl_init("https://api.mudbase.dev/api/sandboxes/projects/{$projectId}");
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        "x-api-key: {$apiKey}",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'language'        => 'php',
        'languageVersion' => '8.3',
        'timeoutSeconds'  => 300,
    ]),
]);
$body = json_decode(curl_exec($ch), true);
echo $body['sessionId'] . PHP_EOL;
<?php
$projectId = getenv('CELLS_PROJECT_ID');
$apiKey    = getenv('CELLS_API_KEY');

$ch = curl_init("https://api.mudbase.dev/api/sandboxes/projects/{$projectId}");
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        "x-api-key: {$apiKey}",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'language'        => 'php',
        'languageVersion' => '8.3',
        'timeoutSeconds'  => 300,
    ]),
]);
$body = json_decode(curl_exec($ch), true);
echo $body['sessionId'] . PHP_EOL;

Generate a typed client

openapi-generator
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g php \
  -o ./cells-client
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g php \
  -o ./cells-client