|
1 | | -<p> |
2 | | - <a href="https://packagist.org/packages/carloeusebi/laravel-registr-sport-e-salute"> |
3 | | - <img alt="Total Downloads" src="https://img.shields.io/packagist/dt/carloeusebi/laravel-registro-sport-e-salute"> |
4 | | - </a> |
5 | | - <a href="https://packagist.org/packages/carloeusebi/laravel-registr-sport-e-salute"> |
6 | | - <img alt="Latest Version" src="https://img.shields.io/packagist/v/carloeusebi/laravel-registro-sport-e-salute"> |
7 | | - </a> |
8 | | - <a href="https://packagist.org/packages/carloeusebi/laravel-registr-sport-e-salute"> |
9 | | - <img alt="License" src="https://img.shields.io/packagist/l/carloeusebi/laravel-registro-sport-e-salute"> |
10 | | - </a> |
11 | | -</p> |
12 | | - |
13 | | ------- |
| 1 | +<a href="https://github.com/carloeusebi/laravel-registro-sport-e-salute/actions" target="_blank"> |
| 2 | + <img alt="Tests" src="https://github.com/carloeusebi/laravel-registro-sport-e-salute/actions/workflows/tests.yml/badge.svg"> |
| 3 | +</a> |
| 4 | +<a href="https://packagist.org/packages/carloeusebi/laravel-registro-sport-e-salute" target="_blank"> |
| 5 | + <img alt="Total Downloads" src="https://img.shields.io/packagist/dt/carloeusebi/laravel-registro-sport-e-salute"> |
| 6 | +</a> |
| 7 | +<a href="https://packagist.org/packages/carloeusebi/laravel-registro-sport-e-salute" target="_blank"> |
| 8 | + <img alt="Latest Version" src="https://img.shields.io/packagist/v/carloeusebi/laravel-registro-sport-e-salute"> |
| 9 | +</a> |
| 10 | +<a href="https://packagist.org/packages/carloeusebi/laravel-registro-sport-e-salute" target="_blank"> |
| 11 | + <img alt="License" src="https://img.shields.io/packagist/l/carloeusebi/laravel-registro-sport-e-salute"> |
| 12 | +</a> |
14 | 13 |
|
| 14 | +# Laravel Registro Sport e Salute |
| 15 | + |
| 16 | +A Laravel package that provides a simple and elegant wrapper around the Italian "Registro Sport e Salute" API. This |
| 17 | +package allows you to search and retrieve information about sports organizations registered in the Italian Sports |
| 18 | +Registry. |
| 19 | + |
| 20 | +Please visit the original [https://registro.sportesalute.eu](https://registro.sportesalute.eu/#/registro). |
| 21 | + |
| 22 | +## Table of Contents |
| 23 | + |
| 24 | +- [Requirements](#requirements) |
15 | 25 | - [Installation](#installation) |
| 26 | +- [Usage](#usage) |
| 27 | + - [Basic Usage](#basic-usage) |
| 28 | + - [Filtering](#filtering) |
| 29 | + - [Pagination](#pagination) |
| 30 | + - [Getting Organization Details](#getting-organization-details) |
| 31 | +- [Frontend Integration](#frontend-integration) |
| 32 | +- [Testing](#testing) |
| 33 | +- [Contributing](#contributing) |
| 34 | +- [License](#license) |
| 35 | + |
| 36 | +## Requirements |
| 37 | + |
| 38 | +- PHP 8.4 or higher |
| 39 | +- Laravel 12.15 or higher |
16 | 40 |
|
17 | 41 | ## Installation |
18 | 42 |
|
19 | 43 | Run the following command to install the latest version of the package: |
20 | 44 |
|
21 | 45 | ```bash |
22 | 46 | composer require carloeusebi/laravel-registro-sport-e-salute |
23 | | -``` |
| 47 | +``` |
| 48 | + |
| 49 | +## Usage |
| 50 | + |
| 51 | +### Basic Usage |
| 52 | + |
| 53 | +```php |
| 54 | +use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; |
| 55 | + |
| 56 | + |
| 57 | +// Get organizations (returns a Collection of Organization objects) |
| 58 | +$organizations = RegistroSportESalute::get(); |
| 59 | + |
| 60 | +// Access organization properties |
| 61 | +foreach ($organizations as $organization) { |
| 62 | + echo $organization->getDenominazione(); // Organization name |
| 63 | + echo $organization->getCodiceFiscale(); // Tax code |
| 64 | + echo $organization->getRegioneSedeLegale(); // Region |
| 65 | + echo $organization->getComuneSedeLegale(); // City |
| 66 | + |
| 67 | + // Convert to array |
| 68 | + $organizationArray = $organization->toArray(); |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +### Filtering |
| 73 | + |
| 74 | +You can filter organizations by name (denominazione) or tax code (codice fiscale): |
| 75 | + |
| 76 | +```php |
| 77 | +use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; |
| 78 | + |
| 79 | +// Filter by name |
| 80 | +$organizations = RegistroSportESalute::filterByDenominazione('Sport Club')->get(); |
| 81 | + |
| 82 | +// Filter by tax code |
| 83 | +$organizations = RegistroSportESalute::filterByCodiceFiscale('12345678901')->get(); |
| 84 | + |
| 85 | +// Chain filters |
| 86 | +$organizations = RegistroSportESalute::builder() |
| 87 | + ->filterByDenominazione('Sport Club') |
| 88 | + ->filterByCodiceFiscale('12345678901') |
| 89 | + ->get(); |
| 90 | +``` |
| 91 | + |
| 92 | +### Pagination |
| 93 | + |
| 94 | +The API supports pagination: |
| 95 | + |
| 96 | +```php |
| 97 | +use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; |
| 98 | + |
| 99 | +// Set page (default is 1) |
| 100 | +$organizations = RegistroSportESalute::page(2)->get(); |
| 101 | + |
| 102 | +// Set page size (default is 10) |
| 103 | +$organizations = RegistroSportESalute::pageSize(20)->get(); |
| 104 | + |
| 105 | +// Chain with filters |
| 106 | +$organizations = RegistroSportESalute::filterByDenominazione('Sport Club') |
| 107 | + ->page(2) |
| 108 | + ->pageSize(20) |
| 109 | + ->get(); |
| 110 | +``` |
| 111 | + |
| 112 | +### Getting Organization Details |
| 113 | + |
| 114 | +You can get detailed information about a specific organization by its ID: |
| 115 | + |
| 116 | +```php |
| 117 | +use CarloEusebi\RegistroSportESalute\Facades\RegistroSportESalute; |
| 118 | + |
| 119 | +// Get organization details by ID |
| 120 | +$details = RegistroSportESalute::getById(123); |
| 121 | + |
| 122 | +// $details is an associative array with organization details |
| 123 | +echo $details['Denominazione']; |
| 124 | +echo $details['Codice Fiscale']; |
| 125 | +// etc. |
| 126 | +``` |
| 127 | + |
| 128 | +## Testing |
| 129 | + |
| 130 | +This package includes a comprehensive test suite. To run the tests: |
| 131 | + |
| 132 | +```bash |
| 133 | +composer test |
| 134 | +``` |
| 135 | + |
| 136 | +You can also run specific test suites: |
| 137 | + |
| 138 | +```bash |
| 139 | +# Run only unit tests |
| 140 | +composer test:unit |
| 141 | + |
| 142 | +# Check types wit PHPStan |
| 143 | +composer test:types |
| 144 | + |
| 145 | +# Check code style with Pint |
| 146 | +composer test:lint |
| 147 | +``` |
| 148 | + |
| 149 | +## Contributing |
| 150 | + |
| 151 | +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details. |
| 152 | + |
| 153 | +## License |
| 154 | + |
| 155 | +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
0 commit comments