Download the PHP package onestopmobile/printnode-sdk without Composer
On this page you can find all versions of the php package onestopmobile/printnode-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onestopmobile/printnode-sdk
More information about onestopmobile/printnode-sdk
Files in onestopmobile/printnode-sdk
Package printnode-sdk
Short Description PrintNode integration for PHP and Laravel to send print jobs, shipping labels, PDFs, and ZPL to remote printers.
License MIT
Homepage https://github.com/onestopmobile/printnode-sdk
Informations about the package printnode-sdk
One Stop Mobile PrintNode SDK
A PHP 8.5+ SDK for PrintNode with typed API access and an optional Laravel print layer.
Use it when you want:
- typed access to the PrintNode API
- a framework-agnostic core for any PHP application
- a higher-level Laravel printing API for common PDF and ZPL flows
- target-based printer resolution through your own application logic
- optional non-production print guards
- optional PSR-3 and Laravel log-channel support for print activity
Choose Your Entry Point
- Use the core SDK if you want typed access to PrintNode resources from any PHP app or framework.
- Use the Laravel layer if you want short application code like
DispatchPrint::printer(...)->pdfUrl(...)orDispatchPrint::to(...)->zpl(...).
Installation
Minimum requirement: PHP 8.5.
If you are working on this repository itself instead of consuming the package, use:
Recommended .env setup:
Supported API Areas
whoamicomputersprintersprintjobsscalesHTTP endpointswebhooksaccountdownloadsmiscendpoints likepingandnoop
SDK Endpoint Matrix
| API area | SDK entry point | Public methods |
|---|---|---|
whoami |
whoAmI(), whoAmIResource() |
get() |
computers |
computers() |
all(), get(), delete() |
printers |
printers() |
all() |
printjobs |
printJobs() |
all(), get(), create(), delete(), states(), byPrinters(), deleteByPrinters() |
downloads |
downloads() |
all(), get(), latest(), update() |
scales |
scales() |
listConnected(), all(), byDeviceName(), get(), test() |
webhooks |
webhooks() |
all(), create(), update(), delete() |
account |
account() |
create(), update(), delete(), controllable(), getState(), setState(), getTag(), setTag(), deleteTag(), getApiKey(), createApiKey(), deleteApiKey(), clientKey() |
misc |
misc() |
ping(), noop() |
Full low-level SDK reference: docs/sdk-reference.md.
Typed API Usage
Typed child-account creation
Child-account impersonation
Laravel integration
The package ships with OneStopMobile\PrintNodeSdk\Laravel\PrintNodeServiceProvider and a publishable config file:
Supported Laravel integration target: 12.x and 13.x.
Laravel uses the same recommended env names shown above.
For array- and class-based options like allowed_environments, resolver, and default_options, use the published config/printnode.php file.
High-level printing API
The package also ships with a Laravel-friendly print abstraction for short application code.
Direct printing to a known PrintNode printer id:
This is the fastest path when your application already knows the external PrintNode printer id.
Printing raw content:
Or use the semantic ZPL helper:
Using dependency injection instead of the facade:
If you prefer to avoid a long list of named arguments when customizing the print layer, configure it through PrintManagerConfig:
Target-based printing
If your application does not store raw PrintNode printer ids everywhere, you can resolve arbitrary app targets through a user-defined resolver.
The package itself does not assume anything about databases, Eloquent models or your own printer storage. You provide that behavior by binding OneStopMobile\PrintNodeSdk\Contracts\ResolvesPrintTarget.
to(...) is the Laravel-facing name for this flow.
See docs/laravel-printing.md for the full resolver example and integration guide.
Laravel print safety and logging
The Laravel integration can optionally protect physical printers outside selected environments and can log print activity through an existing Laravel log channel.
The published config defaults are intentionally safe:
- In
localanddevelop, print jobs are skipped before they reach PrintNode and a skipped-job log entry is written. - In
production, the same defaults allow jobs to be sent to PrintNode. - The default preferred log channel is
print-node. If that channel is not configured in Laravel, the package falls back to the app logger.
Published printnode.php config supports:
When logging is enabled, the package logs metadata such as printer id, title, content type, request id and payload length. Payload hashes are optional and disabled by default. Raw ZPL/PDF content is not logged by default.
Error handling
Failed API responses are mapped to SDK exceptions:
AuthenticationExceptionAuthorizationExceptionValidationExceptionResourceNotFoundExceptionConflictExceptionRateLimitExceptionApiErrorExceptionPrintDispatchBlockedExceptionInvalidIdentifierSetExceptionUnresolvablePrintTargetExceptionIncompletePrintJobException
RateLimitException also exposes the raw Retry-After header when the API provides one.
Development scripts
Live GET smoke test
You can run a non-destructive live smoke test through the SDK itself with an API key argument:
Default GET suite:
pingwhoamicomputersprintersprintjobswithlimit=5printjob stateswithlimit=5download clients
Extended GET suite:
account statecontrollable accountswebhooksconnected scales