carloeusebi / laravel-registro-sport-e-salute
A Laravel package that provides a simple and elegant wrapper around the Italian "Registro Sport e Salute" API. This package allows you to search and retrieve information about sports organizations registered in the Italian Sports Registry.
Fund package maintenance!
www.paypal.com/paypalme/carloeusebi
Requires
- php: ^8.4.0
- illuminate/cache: ^12.16
- illuminate/http: ^12.15
- illuminate/support: ^12.15
- illuminate/testing: ^12.16
Requires (Dev)
- laravel/pint: ^1.22.1
- orchestra/testbench: ^10.3
- pestphp/pest: ^4.0.0
- pestphp/pest-plugin-type-coverage: ^4.0.0
- phpstan/phpstan: ^2.1.16
- rector/rector: ^2.0.16
- symfony/var-dumper: ^7.2.6
README
Laravel Registro Sport e Salute
A Laravel package that provides a simple and elegant wrapper around the Italian "Registro Sport e Salute" API. This package allows you to search and retrieve information about sports organizations registered in the Italian Sports Registry.
Please visit the original https://registro.sportesalute.eu.
Table of Contents
Requirements
- PHP 8.4 or higher
- Laravel 12.15 or higher
Installation
Run the following command to install the latest version of the package:
composer require carloeusebi/laravel-registro-sport-e-salute
Usage
Basic Usage
use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; // Get organizations (returns a Collection of Organization objects) $organizations = RegistroSportESalute::get(); // Access organization properties foreach ($organizations as $organization) { echo $organization->getDenominazione(); // Organization name echo $organization->getCodiceFiscale(); // Tax code echo $organization->getRegioneSedeLegale(); // Region echo $organization->getComuneSedeLegale(); // City // Convert to array $organizationArray = $organization->toArray(); }
Filtering
You can filter organizations by name (denominazione) or tax code (codice fiscale):
use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; // Filter by name $organizations = RegistroSportESalute::filterByDenominazione('Sport Club')->get(); // Filter by tax code $organizations = RegistroSportESalute::filterByCodiceFiscale('12345678901')->get(); // Chain filters //💡 Tip: the `builder` method is an eye candy for when you have multiple statements $organizations = RegistroSportESalute::builder() ->filterByDenominazione('Sport Club') ->filterByCodiceFiscale('12345678901') ->get();
The ability to filter by other fields may come in future updates, or if you really really need it you can submit a PR.
Pagination
The API supports pagination:
use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; // Set page (default is 1) $organizations = RegistroSportESalute::page(2)->get(); // Set page size (default is 10) $organizations = RegistroSportESalute::page(pageSize: 25)->get(); // Chain with filters $organizations = RegistroSportESalute::builder() ->filterByDenominazione('Sport Club') ->page(2, 25) ->get();
Order
Order feature is not present. If you need it please create an issue or submit a PR.
Getting Organization Details
You can get detailed information about a specific organization by its ID:
use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; // Get organization details by ID $details = RegistroSportESalute::getById(123); // $details is an associative array with organization details echo $details['Denominazione']; echo $details['Codice Fiscale']; // etc.
Testing
This package includes a comprehensive test suite. To run the tests:
composer test
You can also run specific test suites:
# Run only unit tests composer test:unit # Check types wit PHPStan composer test:types # Check code style with Pint composer test:lint
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.