aso824 / octoprint-php-api
OctoPrint API client written in PHP
v0.1.2
2020-09-26 22:30 UTC
Requires
- php: ^7.4
- ext-json: *
- nyholm/psr7: ^1.3
- phpdocumentor/reflection-docblock: ^5.0
- psr/http-client: ^1.0
- psr/http-message: ^1.0
- symfony/property-access: ^5.0
- symfony/serializer: ^5.0
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2024-04-27 07:01:57 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.