aternos/blob-build-api

PHP client for the blob.build API. This client is based on OpenAPI.

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/aternos/blob-build-api

1.0.1 2025-10-10 15:04 UTC

This package is auto-updated.

Last update: 2025-10-10 15:05:16 UTC


README

An API client for the blob.build API written in PHP. This client is a combination of code generated by OpenAPI Generator and some wrappers around it to improve the usability.

The generated code can be found in src/Api and src/Model. It is recommended to use the Wrappers in src/Client instead of the generated code.

Installation

Install the package via composer:

composer require aternos/blob-build-api

Usage

The main entry point for the API is the BlobBuildAPIClient class.

<?php
use Aternos\BlobBuild\Client\BlobBuildAPIClient;

// create an API client. This is the main entry point for the API
$client = new BlobBuildAPIClient();

// set a user agent (recommended)
$client->setUserAgent('aternos/php-blob-build-api-example');

Projects

Listing all projects

You can list all projects using the listProjects method.

$projects = $client->listProjects();

foreach ($projects as $project) {
    echo "Project " . $project->getData()->getName() . " by " . $project->getData()->getOwner() . PHP_EOL;
}

Searching for projects

To search for projects, you can use the searchProjects method with a search query.

$projects = $client->searchProjects("sound");

foreach ($projects as $project) {
    echo "Project " . $project->getData()->getName() . " by " . $project->getData()->getOwner() . PHP_EOL;
}

Fetching a specific project

To fetch a specific project, you can use the getProject method with the project's name.

$project = $client->getProject("SoundMuffler");
echo "Project " . $project->getData()->getName() . PHP_EOL;

Unlike the projects retrieved from listProjects and searchProjects, this method does not contain the project owner.

Builds

Listing all builds for a project

You can list all builds for a project using the getProjectBuilds method with the project's name. This returns an array where the keys are the name of a release channel and the values are arrays of builds for that channel.

$result = $client->getProjectBuilds("SoundMuffler");
foreach ($result as $channel => $builds) {
    echo "Channel: " . $channel . PHP_EOL;
    foreach ($builds as $build) {
        echo " - Build " . $build->getData()->getBuildId() . PHP_EOL; 
    }
}

// or with the project wrapper
$project = $client->getProject("SoundMuffler");
$result = $project->getBuilds();

Fetching the latest build for a project

You can also fetch the latest build for a project in a specific channel.

$build = $client->getLatestProjectBuildInChannel("SoundMuffler", "Dev");
echo "Build " . $build->getData()->getBuildId() . PHP_EOL;

// Or with the project wrapper
$project = $client->getProject("SoundMuffler");
// Either pick a channel
$build = $project->getLatestBuildInChannel("Dev");
// Or use the default channel
$build = $project->getLatestBuildInDefaultChannel()

Fetching a specific build

$build = $client->getProjectBuild("SoundMuffler", "Dev", 1);
echo "Build " . $build->getData()->getBuildId() . PHP_EOL;

// Or with the project wrapper
$project = $client->getProject("SoundMuffler");
$build = $project->getBuild("Dev", 1);

Updating the generated code

The generated code can be updated by installing the openapi generator and running the following command:

openapi-generator-cli generate -c config.yaml