This Laravel wrapper allows you to integrate Fatture in Cloud using Api v2.
- Laravel >= 8.37
- PHP >= 8.1
- ext-json
You can install the package via composer:
composer require datomatic/laravel-fatture-in-cloud
Optionally, you can publish the config file with:
php artisan vendor:publish --provider="Datomatic\FattureInCloud\FattureInCloudServiceProvider" --tag="fatture-in-cloud-config"
This is the contents of the published config file:
return [
'access_token' => env('FATTURE_IN_CLOUD_ACCESS_TOKEN'),
'company_id' => env('FATTURE_IN_CLOUD_COMPANY_ID'),
'endpoint' => env('FATTURE_IN_CLOUD_ENDPOINT','https://api-v2.fattureincloud.it/'),
];
PS: to obtain company_id please see this article.
Get FattureInCloud class from service container or using FattureInCloud
Facade.
use Datomatic\FattureInCloud\Facades\FattureInCloud;
//Facade
FattureInCloud::invoices()->...
use Datomatic\FattureInCloud\FattureInCloud;
//Automatic Injection
public function __construct(FattureInCloud $fic){}
//Resolve
$fic = App::make(FattureInCloud::class);
$fic = app(Datomatic\FattureInCloud\FattureInCloud::class);
Use the Fatture In Cloud utilities classes
$fic->clients()->create([... user array...]);
Please see the functionalities and the array to pass on Official Documentation.
The resources covered are:
- user()
- info()
- products()
- clients()
- suppliers()
- invoices()
- quotes()
- proformas()
- receipts()
- deliveryNotes()
- creditNotes()
- orders()
- selfOwnInvoices()
- selfSupplierInvoices()
- invoices()
- work_reports()
- supplierOrders()
- expenses()
- passiveCreditNotes()
- passiveDeliveryNotes()
- paymentAccounts()
- paymentMethods()
Each resource has the same methods available:
all(array $data = [])
create(array $data)
edit(int $id, array $data)
delete(int $id, array $data = [])
getById(int $id, array $data = [])
The methods will return an array with the response from Fatture in Cloud API (except for the delete method that may return null).
For example, to fetch all clients (according to Official Documentation) you should call:
$fic->clients()->all(['fieldset' => 'detailed'])
To improve the use of api usage is included a comfortable list of utilities enums:
- DocumentStatus
- EntityType
- IssuedDocumentType
- ReceivedDocumentType
- PaymentStatus
The Fatture in CLoud API accept only a fullname on country field 🤦♂️ so i add a Datomatic\FattureInCloud\Utilities\CountryConverter
utility class with fromAlpha2
and fromName
methods.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.