chanshige / houjin-bangou
'chanshige/houjin-bangou' is that helps search for corporate information registered in the NTA(National Tax Agency)
Installs: 477
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chanshige/houjin-bangou
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: 2025-10-15 20:39:15 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')
]