Download the PHP package andreilungeanu/smartbill without Composer
On this page you can find all versions of the php package andreilungeanu/smartbill. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andreilungeanu/smartbill
More information about andreilungeanu/smartbill
Files in andreilungeanu/smartbill
Package smartbill
Short Description A Laravel package for the Smartbill API.
License MIT
Homepage https://github.com/andreilungeanu/smartbill
Informations about the package smartbill
Smartbill Laravel Package
A Laravel package for the Smartbill API, supporting Laravel 11, 12 and 13. CI tests against Laravel 13.
Installation
You can install the package via composer:
Configuration
You can publish the configuration file with:
This will create a config/smartbill.php file in your application's config directory. You should add your Smartbill API credentials to your .env file:
Usage Examples
You can interact with the API in three ways:
1. Using the Facade (recommended for Laravel)
This is the most convenient method for use within a Laravel application.
2. Using the Service Container
This is useful for dependency injection within your own classes.
Both of these methods work seamlessly because Laravel's service container automatically handles the creation of the required HTTP client and injects it into the package.
3. Manual Instantiation (Advanced)
Parameterless new Smartbill() is no longer possible: the constructor now takes a configured HTTP client. If you need to use this package outside of a Laravel application or wish to manually construct the object, you must now provide a configured Illuminate\Http\Client\PendingRequest instance to its constructor.
Example 1: Creating an Invoice
This example shows how to create a new invoice and retrieve its number.
Example API Response
A successful createV2 call will return an array decoded from the following JSON structure:
documentViewUrl is a public link that needs no authentication. It serves an HTML view of
the document, not the PDF — use getPdf() below for the PDF bytes.
The deprecated create() returns the same body without the last three keys.
Example 2: Downloading an Invoice PDF
This example shows how to download the PDF content of an existing invoice.
And many more...
This is just a small sample of the available methods. The authoritative contract is Smartbill's OpenAPI spec at api.smartbill.ro. DOCUMENTATION.md is an older transcription kept on GitHub for reference; it still shows some deprecated signatures.
Error handling
A misspelled or wrongly typed field is rejected with 400 and a body that names the
offending field. The package surfaces it as SmartbillRequestException:
Every other failure throws SmartbillApiException. getMessage() is the cause only —
Smartbill sometimes wraps it in HTML meant for its own interface; the tags and the trailing
help text are removed, and the wrapped detail is kept.
getResponse() still holds the untouched response.
Exceeding the rate limit (30 calls per 10 seconds per token) throws
SmartbillRateLimitException and locks the token for ten minutes. Do not retry it.
Known Issues
Smartbill-side behaviour, verified against the live API on 2026-08-23. Listed so callers know what to expect; none of it is something this package can fix.
- A rate-limit breach answers
403, not the documented429. The blocking response carries noRetry-Afterand noX-RateLimit-*headers, and itscooldownfield is0even though the token stays locked for ten minutes.X-RateLimit-*ride on2xxonly — every error response drops them, so they cannot drive a backoff. - A
cifthat does not belong to the account answers401, not403. Retrying with fresh credentials will not help; the credentials are fine, thecifis not. GET /invoice/pdfanswers502with an nginx HTML page for an unknown document or a missing parameter, which is indistinguishable from a real outage.GET /estimate/pdfanswers a normal400witherrorTextfor the same mistake.GET /payment/textanswers500with a Tomcat error page for an unknownid.GET /estimate/invoicesanswers200with a populatederrorTextwhen the proforma exists but has not been invoiced. That is the normal state, not a failure — readareInvoicesCreated. A proforma that does not exist answers410./document/sendrequiressubjectandbodyTextBase64 encoded. Existence is checked first, so an unknown document answersDocumentul nu a fost gasitand the Base64 requirement never surfaces — test it against a document that exists.GET /serieslists onlyf,pandcseries. Other configured document types are not reachable through the API, filtered or unfiltered.- A
Bonpayment sent withoutproductsanswers500. Send the product lines; the documented400for a missing cash register only appears once the request is complete.
Internal Server Errors on Invalid Request Data — fixed by Smartbill
Resolved. This issue was found and reported from this package. Re-tested against the live API on 2026-08-23 and confirmed fixed: a misspelled field now returns
400witherrors[].paramnaming it — precisely the behaviour asked for below. The original report is kept struck through for the record. See Error handling for how the package surfaces it today.
When working with the Smartbill API, there are a few known issues to be aware of:
-
Internal Server Errors on Invalid Request Data:The API may return a500 Internal Server Errorwhen the request payload contains invalid data, such as a typo in a required field name.For example, sendingnumeinstead ofnamein the client object will trigger a500error:Ideally, the API should respond with a400 Bad Requeststatus and a helpful error message detailing which field is incorrect. Instead, it returns a generic500error, which makes debugging difficult as it incorrectly suggests a server-side failure rather than a client-side mistake.
While this package attempts to mitigate these issues where possible, the fundamental problems lie with the API's implementation. We are awaiting fixes from the Smartbill provider to ensure more reliable and standards-compliant behavior.
AI coding agents (Laravel Boost)
This package ships AI guidelines at resources/boost/guidelines/core.blade.php. If your
application uses Laravel Boost (^2.2), Boost can fold
them into your agent instruction files (CLAUDE.md, AGENTS.md, Cursor rules, ...) so your
assistant knows the API's traps before it writes a single call.
Boost will not enable them on its own — you have to opt in:
On an existing Boost install, use php artisan boost:update --discover instead (Boost
2.3.2+; the default from 2.5.0). Either way, pick andreilungeanu/smartbill when Boost
asks which third-party guidelines to include. Boost skips that prompt in non-interactive
runs, and from 2.5.3 also when boost:update runs as a Composer script — so a
post-update-cmd hook will not add the package for you.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- AndreiLungeanu
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of smartbill with dependencies
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.0