'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登録サンプルを記載しております。
with composer
$ composer require chanshige/houjin-bangou
<?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();
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
];
}
}
'providers' => [
App\Providers\HoujinBangouServiceProvider::class
]
HOUJIN_BANGOU_APPLICATION_ID='*************'
'houjin_bangou' => [
'application_id' => env('HOUJIN_BANGOU_APPLICATION_ID')
]