cieplik206 / laravel-bir-regon
Laravel client for the Polish GUS BIR/REGON API
Requires
- php: ^8.3
- gusapi/gusapi: ^6.3
- illuminate/contracts: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- spatie/laravel-data: ^4.14
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
README
A fluent Laravel client for the Polish GUS BIR/REGON SOAP API.
Use a Laravel facade or dependency injection to search businesses by NIP,
REGON, or KRS, retrieve full and bulk reports, and inspect the current GUS
service status. Responses are returned as typed
spatie/laravel-data objects.
use cieplik206\BirRegon\Facades\BirRegon; $company = BirRegon::forNip('1234567890')->get(); $company->name; $company->regon; $company->toArray();
Features
- Fluent searches by NIP, REGON, and KRS
- Batch searches for up to 20 identifiers
- All full and bulk report types supported by
gusapi/gusapi - Separate production and sandbox clients with reusable sessions
- Typed data objects with array and JSON serialization
- Laravel auto-discovery, facade, and container bindings
- Isolated tests plus an opt-in live sandbox suite
Requirements
- PHP 8.3 or newer
- Laravel 12 or 13
- PHP SOAP and SimpleXML extensions
The test matrix covers Laravel 12 and 13 on PHP 8.3, 8.4, and 8.5. PHP 8.3 is also verified against the lowest supported dependency versions for each Laravel release.
Installation
Install the package via Composer:
composer require cieplik206/laravel-bir-regon
Add your BIR API key to .env:
BIR_API_KEY=your-api-key
The official public sandbox key is configured by default. Override it only when GUS provides a different test key:
BIR_SANDBOX_API_KEY=your-test-key
Laravel discovers the package service provider automatically. You may optionally publish the configuration file:
php artisan vendor:publish --tag=bir-regon-config
See the installation and configuration guides for all available options.
Quick start
Search for a single business with the facade:
use cieplik206\BirRegon\Facades\BirRegon; $byNip = BirRegon::forNip('1234567890')->get(); $byRegon = BirRegon::forRegon('123456789')->get(); $byKrs = BirRegon::forKrs('0000123456')->get();
The same API is available through dependency injection:
use cieplik206\BirRegon\BirRegonService; use cieplik206\BirRegon\Data\CompanyData; class FindCompany { public function __construct( private BirRegonService $birRegon, ) {} public function handle(string $nip): CompanyData { return $this->birRegon->forNip($nip)->get(); } }
Production is the default. Select the isolated GUS test client before building a sandbox request:
$company = BirRegon::sandbox() ->forNip('7740001454') ->get();
Production and sandbox keep separate credentials and authenticated sessions. Multiple builders created from the same service reuse the appropriate session.
Documentation
The complete documentation is available on the documentation website:
- Installation
- Configuration
- Basic usage
- Batch searches
- Full and bulk reports
- Data objects
- Service status and diagnostics
- Error handling
- Testing
- Laravel Boost support
- Extending the package
AI tools can use the
llms.txt documentation index.
Testing
Run the isolated test suite:
composer test
The package also contains an opt-in integration suite that performs real requests against the GUS test environment:
composer test:sandbox
See the testing guide for details.
Laravel Boost support
The package ships the bir-regon-development skill for
Laravel Boost. It teaches supported AI
agents the fluent query API, report workflow, exception hierarchy, and sandbox
testing conventions used by this package.
Install and configure Boost in the consuming Laravel application:
composer require laravel/boost --dev php artisan boost:install
If Boost was already installed before Laravel BIR REGON, discover the new package skill with:
php artisan boost:update --discover
Boost detects skills shipped by Composer packages and offers to install them for the AI agents configured in the application. The integration is optional: Laravel BIR REGON does not require Boost at runtime.
See the Laravel Boost support guide for details.
Changelog
Please see the changelog for information about recent changes.
Contributing
Please see Contributing for details.
Security
Please review the security policy to report vulnerabilities.
Credits
gusapi/gusapifor SOAP communicationspatie/laravel-datafor typed data objects
License
The MIT License. Please see the license file for more information. Third-party dependencies retain their respective licenses; see the third-party notices.