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, offering full compatibility with Laravel versions 11 and 12.
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)
2. Using the Service Container
3. Direct Instantiation
All three methods are valid and provide the same functionality. The Facade is the most convenient for typical Laravel usage, while the other two are useful for testing, dependency injection, or use outside Laravel.
Example 1: Creating an Invoice
This example shows how to create a new invoice and retrieve its number.
Example API Response
A successful create
call will return an array decoded from the following JSON structure:
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. For a complete list of all available endpoints and their parameters, please see the full documentation.
Known Issues
When working with the Smartbill API, there are a few known issues to be aware of:
-
Non-Compliant Headers on 400 Errors: A significant issue exists where the Smartbill API returns non-compliant HTTP headers, particularly when a
400 Bad Request
status is returned. This has been most commonly observed on endpoints like/invoice/pdf
and/estimates/pdf
when a document is not found. The API returns headers with spaces in their names (e.g.,"Entitate atasata"
), which violates the HTTP/1.1 specification (RFC 7230, section 3.2).This non-compliance causes standard HTTP clients like Guzzle (used by Laravel) to throw an
InvalidArgumentException
, as they enforce strict adherence to HTTP standards. To manage this, the package includes a temporary workaround that uses a raw cURL request to bypass Guzzle's validation. While this allows the application to handle the error, please be aware that this behavior may occur in other situations as well. -
Internal Server Errors on Invalid Request Data: The API may return a
500 Internal Server Error
when the request payload contains invalid data, such as a typo in a required field name.For example, sending
nume
instead ofname
in the client object will trigger a500
error:Ideally, the API should respond with a
400 Bad Request
status and a helpful error message detailing which field is incorrect. Instead, it returns a generic500
error, 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.
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
illuminate/support Version ^11.0|^12.0
spatie/laravel-package-tools Version ^1.0