chanshige / houjin-bangou
'chanshige/houjin-bangou' is that helps search for corporate information registered in the NTA(National Tax Agency)
v2.0.0
2022-03-15 12:46 UTC
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- koriym/http-constants: ^1.2
- laminas/laminas-xml2json: ^3.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.4
- phpmd/phpmd: ^2.8
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: ^3.6
This package is auto-updated.
Last update: 2024-10-15 18:38:23 UTC
README
houjin-bangou
'chanshige/houjin-bangou' is that helps search for corporate information registered in the NTA(National Tax Agency)
法人番号システム Web-API を便利に使うライブラリです
@see https://www.houjin-bangou.nta.go.jp/webapi/
※ Web-APIを利用するためには、アプリケーションIDが必要です。
※ Laravelで利用する際のProvider登録サンプルを記載しております。
Installation
with composer
$ composer require chanshige/houjin-bangou
Usage
<?php require __DIR__ . '/vendor/autoload.php'; use Chanshige\NTA\HoujinBangouFactory; use Chanshige\NTA\Condition\Criteria\CorporateName; $houjin = HoujinBangouFactory::newInstance('国税庁より発行されたアプリケーションID'); $condition = new CorporateName(); $condition->name('カラビナテクノロジー'); $response = $houjin($condition); echo $response->body(); //XML(Original) // or $response->toJson(); // or $response->toArray();
for Laravel
create ServiceProvider class.
use Chanshige\NTA\HoujinBangouFactory;
use Chanshige\NTA\Contracts\HoujinBangouInterface;
use GuzzleHttp\Client as GuzzleClient;
use Illuminate\Support\ServiceProvider;
class HoujinBangouServiceProvider extends ServiceProvider implements DeferrableProvider
{
public function register()
{
$this->app->singleton(HoujinBangouInterface::class, static function () {
return HoujinBangouFactory::newInstance(
config('services.houjin_bangou.application_id')
);
});
}
public function provides(): array
{
return [
ClientInterface::class
];
}
}
append providers to config/app.php
'providers' => [
App\Providers\HoujinBangouServiceProvider::class
]
add .env
HOUJIN_BANGOU_APPLICATION_ID='*************'
add config/services.php
'houjin_bangou' => [
'application_id' => env('HOUJIN_BANGOU_APPLICATION_ID')
]