weble/cercaimprese

Laravel Package for OpenAPI.it Cerca Imprese Integration

1.1.0 2022-03-04 13:55 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

With this laravel package you can interact with the Cerca Imprese OpenAPI.

It's built on top of the amazing Saloon Package and requires PHP8.

Installation

You can install the package via composer:

composer require weble/cercaimprese

You can publish the config file with:

php artisan vendor:publish --tag="cercaimprese-config"

This is the contents of the published config file:

return [
    'token' => env('CERCAIMPRESE_TOKEN', ''),
    'test' => env('CERCAIMPRESE_TEST', true)
];

Usage

You can use directly the Facade to interact with the package:

Base Request

Result is a Laravel Collection of the data of the company requested

$result = \Weble\CercaImprese\Facades\CercaImprese::base(search: '[PIVA_OR_CF_OR_ID]');

Advanced Request

The result is a Laravel Collection of the resulting list of companies.

You can search by anoyone of the parameters, or all of them together in any combination (thanks php8 named parameters!).

$result = \Weble\CercaImprese\Facades\CercaImprese::advanced( 
    denominazione: $denominazione,
    provincia: $provincia,
    codice_ateco: $codice_ateco,
    fatturato_min: $fatturato_min,
    fatturato_max: $fatturato_max,
    dipendenti_min: $dipendenti_min,
    dipendenti_max: $dipendenti_max,
    limite: $limite,
    dry_run: $dry_run
);

Testing

You need either an env variable set for CERCAIMPRESE_TOKEN or a .env file with the same variable set.

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.