migda / gugik-php-sdk
PHP SDK for http://capap.gugik.gov.pl/api/fts/ API
Fund package maintenance!
migda
Requires
- php: ^7.4 | ^8.0
- guzzlehttp/guzzle: ^7.0
- spatie/data-transfer-object: ^2.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.8
This package is auto-updated.
Last update: 2024-10-20 01:10:37 UTC
README
PLEASE READ TERMS OF USE OF CAPAP GUGiK API BEFORE USE THIS PACKAGE: http://capap.gugik.gov.pl/api/fts/#_informacja_o_licencji
PHP SDK for http://capap.gugik.gov.pl/api/fts/ API - geocoding and reverse geocoding of administration units, addresses, plots, etc in Poland.
This is an unofficial PHP SDK for the CAPAP GUGiK API.
Installation
You can install the package via composer:
composer require migda/gugik-php-sdk
Usage
// Geocode commune $gugik = new Gugik(); $reqs = new GcSingleJpaCollection([ new GcSingleJpa([ "gm_nazwa" => "dębno", "pow_nazwa" => "brzeski", "woj_nazwa" => "małopolskie", ]), ]); $req = new GcReqJpa([ 'reqs' => $reqs, ]); $results = $gugik->gcGmi($req); $currentResult = $results->current();
// Reverse geocode address point $gugik = new Gugik(); $req = new RgcReqAdr([ 'd' => 500.00, 'x' => 16.925, 'y' => 51.089, ]); $result = $gugik->rgcAdr($req);
// Reverse geocode plot $gugik = new Gugik(); $req = new RgcReqDze([ 'd' => 500.00, 'x' => 16.925, 'y' => 51.089, ]); $result = $gugik->rgcDze($req);
Available methods:
Geocoding
/** * Geokodowanie działek - lpis * Geocode plots (lpis) using post * * http://capap.gugik.gov.pl/api/fts/#_geocodedzelpisusingpost */ public function gcDzeLpis(GcReqDze $req): GcResultCollection /** * Geokodowanie gmin * Geocode communes using post * * http://capap.gugik.gov.pl/api/fts/#_geocodegmiusingpost */ public function gcGmi(GcReqJpa $req): GcResultCollection
Reverse geocoding
/** * Odwrotne geokodowanie - punkty adresowe * Reverse geocode address points using get * * http://capap.gugik.gov.pl/api/fts/#_d8df035f1b22f89d3c826789834b2d65 */ public function rgcAdr(RgcReqAdr $req): GcResult /** * Odwrotne geokodowanie - działki * Reverse geocode plots using get * * http://capap.gugik.gov.pl/api/fts/#_dzeusingget */ public function rgcDze(RgcReqDze $req): GcResult
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
TODO
- Handle more endpoints from: http://capap.gugik.gov.pl/api/fts/
- More complex DTO for responses (right now there is only very basic GcResult class)
- More tests
- Improve exceptions
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.