mrcnpdlk/teryt-api
最新稳定版本:1.1.0
Composer 安装命令:
composer require mrcnpdlk/teryt-api
包简介
Teryt WS1 Api
README 文档
README
TERYT WS1 API - Polish address database
Installation
Install the latest version with composer
composer require mrcnpdlk/teryt-api
Basic usage
Cache
Library supports Cache bundles based on PSR-16 standard.
For below example was used phpfastcache/phpfastcache. phpfastcache/phpfastcache supports a lot of endpoints, i.e. Files, Sqlite, Redis and many other. More information about using cache and configuration it you can find in this Wiki.
/** * Cache in system files */ $oInstanceCacheFiles = new \phpFastCache\Helper\Psr16Adapter('files');
Log
Library also supports logging packages based on PSR-3 standard, i.e. very popular monolog/monolog.
$oInstanceLogger = new \Monolog\Logger('name_of_my_logger'); $oInstanceLogger->pushHandler(new \Monolog\Handler\ErrorLogHandler( \Monolog\Handler\ErrorLogHandler::OPERATING_SYSTEM, \Psr\Log\LogLevel::DEBUG ) );
Teryt Authentication
Service TERYT WS1 shares API based on SOAP Protocol. More information about service you can find on this site There are two ways to connect to the server:
production database- you need login/passwordtesting database- default authentication with default login/password pair
First of all we need configure connection calling setTerytConfig() method and optionally set cache and log instances
use mrcnpdlk\Teryt\Client; use mrcnpdlk\Teryt\NativeApi; use mrcnpdlk\Teryt\Config; $oConfig = new Config([ 'logger' => $oInstanceLogger, 'cache' => $oInstanceCacheFiles, 'username' => 'my_login', 'password' => 'my_password', 'isProduction' => true, ]); $oNativeApi = NativeApi::create($oConfig);
After that we able to call auxiliary static methods defined in NativeApi class, i.e:
var_dump($oNativeApi->CzyZalogowany()); var_dump($oNativeApi->PobierzSlownikCechULIC()); var_dump($oNativeApi->WyszukajMiejscowosc('skiernie',null));
Defined methods (\mrcnpdlk\Teryt\NativeApi)
Almost all methods from official documentation have been mapped and defined.
Full list below \mrcnpdlk\Teryt\NativeApi:
General
| Method | Status | Description |
|---|---|---|
CzyZalogowany() | ???? | |
PobierzDateAktualnegoKatTerc() | ???? | |
PobierzDateAktualnegoKatNTS() | ???? | |
PobierzDateAktualnegoKatSimc() | ???? | |
PobierzDateAktualnegoKatUlic() | ???? |
Catalog TERC
| Method | Status | Description |
|---|---|---|
PobierzListeWojewodztw() | ???? | |
PobierzListePowiatow() | ???? | |
PobierzListeGmin() | ???? | |
PobierzGminyiPowDlaWoj() | ???? |
Catalog NTS
| Method | Status | Description |
|---|---|---|
PobierzListeRegionow() | ???? | |
PobierzListeWojewodztwWRegionie() | ???? | |
PobierzListePodregionow() | ???? | |
PobierzListePowiatowWPodregionie() | ???? | |
PobierzListeGminPowiecie() | ???? |
Catalog ULIC
| Method | Status | Description |
|---|---|---|
PobierzListeUlicDlaMiejscowosci() | ???? |
Catalog SIMC
| Method | Status | Description |
|---|---|---|
PobierzListeMiejscowosciWGminie() | ???? | |
PobierzListeMiejscowosciWRodzajuGminy() | ???? |
Dictionary
| Method | Status | Description |
|---|---|---|
PobierzSlownikRodzajowJednostek() | ???? | |
PobierzSlownikRodzajowSIMC() | ???? | |
PobierzSlownikCechULIC() | ???? |
Catalog
| Method | Status | Description |
|---|---|---|
PobierzKatalogTERCAdr() | ???? | |
PobierzKatalogTERC() | ???? | |
PobierzKatalogNTS() | ???? | |
PobierzKatalogSIMCAdr() | ???? | |
PobierzKatalogSIMC() | ???? | |
PobierzKatalogSIMCStat() | ???? | |
PobierzKatalogULIC() | ???? | |
PobierzKatalogULICAdr() | ???? | |
PobierzKatalogULICBezDzielnic() | ???? | |
PobierzKatalogWMRODZ() | ???? |
Changes
| Method | Status | Description |
|---|---|---|
PobierzZmianyTercUrzedowy() | ???? | |
PobierzZmianyTercAdresowy() | ???? | |
PobierzZmianyNTS() | ???? | |
PobierzZmianySimcUrzedowy() | ???? | |
PobierzZmianySimcAdresowy() | ???? | |
PobierzZmianySimcStatystyczny() | ???? | |
PobierzZmianyUlicUrzedowy() | ???? | |
PobierzZmianyUlicAdresowy() | ???? |
Verification
| Method | Status | Description |
|---|---|---|
WeryfikujAdresDlaMiejscowosci() | ???? | |
WeryfikujAdresDlaMiejscowosciAdresowy() | ???? | |
WeryfikujAdresWmiejscowosci() | ???? | |
WeryfikujAdresWmiejscowosciAdresowy() | ???? | |
WeryfikujAdresDlaUlic() | ???? | |
WeryfikujAdresDlaUlicAdresowy() | ???? | |
WeryfikujNazwaAdresUlic() | ⚠️ | empty response |
WeryfikujNazwaAdresUlicAdresowy() | ???? |
Search
| Method | Status | Description |
|---|---|---|
WyszukajJPT() | ⚠️ | empty response |
WyszukajMiejscowosc() | ???? | |
WyszukajMiejscowoscWJPT() | ???? | |
WyszukajUlice() | ???? | |
WyszukajJednostkeWRejestrze() | ???? | |
WyszukajMiejscowoscWRejestrze() | ???? | |
WyszukajUliceWRejestrze() | ???? |
Defined methods (\mrcnpdlk\Teryt\Api)
| Method | Status | Description |
|---|---|---|
getCity() | ???? |
$oApi = new \mrcnpdlk\Teryt\Api($oClient); print_r($oApi->getCity('0700884'));
mrcnpdlk\Teryt\Model\City Object ( [id] => 0700884 [parentId] => 0700884 [rmId] => 01 [rmName] => wieś [name] => Burzenin [commune] => mrcnpdlk\Teryt\Model\Commune Object ( [id] => 101414 [tercId] => 1014052 [name] => Burzenin [typeId] => 2 [typeName] => gmina wiejska [district] => mrcnpdlk\Teryt\Model\District Object ( [id] => 1014 [name] => sieradzki [typeName] => powiat [province] => mrcnpdlk\Teryt\Model\Province Object ( [id] => 10 [name] => ŁÓDZKIE ) ) ) ) 统计信息
- 总下载量: 37.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04