Search by

aso824 / octoprint-php-api

aso824

This package is abandoned and no longer maintained. No replacement package was suggested.

OctoPrint API client written in PHP

Package info

github.com/aso824/octoprint-php-api

pkg:composer/aso824/octoprint-php-api

Statistics

Installs: 21

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.3 2024-10-08 12:19 UTC

This package is auto-updated.

Last update: 2026-05-13 11:34:56 UTC


README

API wrapper to allow easy use of OctoPrint REST API in your PHP appplication.

Please note that library is currently in WIP status.

Requirements

  • PHP ^7.4
  • Symfony Serializer ^5.0
  • Any PSR-18 compatible HTTP client (consider using HTTPlug)
  • OctoPrint ^1.4

Installation

composer require aso824/octoprint-php-api

Usage

This simple example below assumes that you are using HTTPlug and have any compatible HTTP client.

use Http\Discovery\HttpClientDiscovery;
use aso824\OctoPrintPHP\Client;
use aso824\OctoPrintPHP\Configuration;

$httpClient = HttpClientDiscovery::find();

$configuration = new Configuration('http://octoprint.local', 'your-api-key');  
$octoClient = new Client($configuration, $httpClient);

var_dump($octoClient->getVersion()->getServer()); // "1.4.2"

$file = $octoClient->files->getFile('test.gcode');
var_dump($file->getGcodeAnalysis()->getEstimatedPrintTime()); // 10120 (seconds)

For list of available action please visit OctoPrint REST API documentation.

Currently implemented endpoints

API resource Status
Connection ✔️
Files ✅ Without upload
Jobs ❌
Languages ❌
Log files ❌
Printer operations ❌
Printer profiles ❌
Settings ❌
Slicing ❌
System ❌
Timelapse ❌
Access control ❌
Util ❌

Contributing

All pull requests are welcome. Please follow same convention as in already existing files.

License

This library is under MIT license.