datomatic / laravel-fatture-in-cloud
Laravel wrapper for Fatture in Cloud API v2
Fund package maintenance!
Datomatic
Installs: 1 461
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 1
Forks: 6
Open Issues: 0
Requires
- php: ^8.1
- ext-json: *
- datomatic/laravel-enum-helper: ^1.0|^2.0
- illuminate/contracts: ^8.37||^9.0|^10.0|^11.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
README
Laravel wrapper for Fatture in Cloud API v2
This Laravel wrapper allows you to integrate Fatture in Cloud using Api v2.
Requirements
- Laravel >= 8.37
- PHP >= 8.1
- ext-json
Installation
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.
Usage
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'])
Enums
To improve the use of api usage is included a comfortable list of utilities enums:
- DocumentStatus
- EntityType
- IssuedDocumentType
- ReceivedDocumentType
- PaymentStatus
Utilities
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.
Testing
composer test
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
License
The MIT License (MIT). Please see License File for more information.