1. Go to this page and download the library: Download id-sign/business-registers library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
id-sign / business-registers example snippets
use IdSign\BusinessRegisters\Adis\VatRegisterClient;
use IdSign\BusinessRegisters\Ares\AresClient;
use IdSign\BusinessRegisters\CompanyLookup;
use IdSign\BusinessRegisters\Isir\InsolvencyClient;
use IdSign\BusinessRegisters\Vies\ViesClient;
use Symfony\Component\HttpClient\HttpClient;
$http = HttpClient::create();
$ares = new AresClient($http);
$vatRegister = new VatRegisterClient($http);
$vies = new ViesClient($http);
$isir = new InsolvencyClient($http);
$lookup = new CompanyLookup($ares, $vatRegister, $vies, $isir);
use IdSign\BusinessRegisters\RiskFlag;
use IdSign\BusinessRegisters\Section;
use IdSign\BusinessRegisters\SectionStatus;
$profile = $lookup->byCompanyId('452 746 49', Section::Vat, Section::Vies, Section::Insolvency);
if (null === $profile) {
// ARES does not hold the subject (usually also true for deleted subjects)
return;
}
echo $profile->company->name; // "ČEZ, a. s."
$profile->isComplete(); // false if a requested section is Unavailable or Rejected, or Insolvency is NotApplicable
$profile->status(Section::Vat); // SectionStatus::Ok
$profile->vat?->type; // SubjectType::VatPayer
$profile->vies?->valid; // true
$profile->insolvencies?->hasOngoing(); // false
$profile->flags(); // list<RiskFlag>, e.g. [RiskFlag::UnreliableVatPayer]
$profile->hasFlag(RiskFlag::Ceased); // false
if (SectionStatus::Unavailable === $profile->status(Section::Vies)) {
$profile->error(Section::Vies); // the ServiceUnavailable or InvalidResponse that caused it
}
use IdSign\BusinessRegisters\VatId;
$lookup = new CompanyLookup($ares, $vatRegister, $vies, $isir, viesRequester: VatId::parse('CZ12345678'));
use IdSign\BusinessRegisters\CompanyId;
// ids your database stored from $company->id: re-hydrate with fromRegister(); parse() is for user input only
$requested = array_map(CompanyId::fromRegister(...), $icosFromDatabase); // list<CompanyId>
$profiles = $lookup->byCompanyIds($requested, Section::Vat);
foreach ($profiles as $profile) { // values only, in ARES response order: each batch of 100 ascending
$profile->status(Section::Vat); // by IČO, batches in request order — no global order
}
$profiles->get('45274649')?->isVatPayer(); // ids in any form, as in Companies
foreach ($profiles->missing($requested) as $id) { // list<CompanyId> — not held by ARES
}
use IdSign\BusinessRegisters\CompanyId;
CompanyId::parse(' 452 746 49 '); // 45274649
CompanyId::parse('64581'); // 00064581
CompanyId::tryParse('12345678'); // null (check digit)
(string) CompanyId::parse('64581'); // "00064581"
CompanyId::fromRegister('123562'); // 00123562 — format only, for an IČO ARES uses although it fails the check digit
CompanyId::fromRegister('123562')->hasValidCheckDigit(); // false
use IdSign\BusinessRegisters\Ares\CompanySearch;
$company = $ares->find('45274649'); // ?Company; null when ARES does not hold the subject
$company->name;
$company->seat?->street; // "Duhová 1444/2"
$company->seat?->postalCodeFormatted(); // "140 00"
$company->vatId; // ?VatId — a filled value does not mean "VAT payer"
$company->vatLookupId(); // ?VatId — the one to send to ADIS and VIES
$company->taxOfficeCode; // ?string — ARES financniUrad: workplace (e.g. "293") or "013" Specialised Tax Office; code list FinancniUrad
$company->isNaturalPerson(); // legal form 100, 101–108, 424, 425
$company->hasCeased(); // ARES datumZaniku (end of existence or registration) not after today (Europe/Prague); pass a date to ask for another calendar day
$company->registrations->active(); // list<AresRegister>
// ids your database stored from $company->id: re-hydrate with fromRegister(); parse() is for user input only
$requested = array_map(CompanyId::fromRegister(...), $icosFromDatabase); // list<CompanyId>
$companies = $ares->findMany($requested);
$companies->has('64581'); // ids in any form: "00064581", "452 746 49", a CompanyId
$companies->get('00064581')?->name;
count($companies);
foreach ($companies as $company) { // values only, in ARES response order: each batch of 100 ascending by IČO,
} // batches in request order — no global order
foreach ($companies->missing($requested) as $id) { // list<CompanyId> — not found in ARES (e.g. deleted)
}
$result = $ares->search(new CompanySearch(name: 'Komerční banka', limit: 20, offset: 0));
$result->total; // all matches, not only this page
foreach ($result->companies as $company) { // list<Company>
$company->id; // ?CompanyId — null for a subject without IČO
$company->aresId; // company id or "ARES_########" for such a subject
}
$subject = $vatRegister->find('CZ45274649'); // ?VatSubject; null when the register does not hold it
$subject->type; // SubjectType::VatPayer
$subject->isVatPayer(); // true for a VAT payer and a VAT group
$subject->unreliable; // bool
$subject->taxOfficeCode; // ?string — ADIS cisloFu: regional office 451–464 (e.g. "461") or "013"; code list FinancniUrad
$subject->activeBankAccounts(); // list<BankAccount>
(string) $subject->activeBankAccounts()[0]; // e.g. "71504011/0100"
$subject->hasPublishedAccount('27-5868650297/0100');
$subject->hasPublishedAccount('CZ6501000000275868650297');
$result = $vies->check('CZ45274649', requester: 'CZ12345678');
$result->valid; // bool — an invalid VAT id is a result, not an exception
$result->name; // ?string — null when the member state does not disclose it (Germany)
$result->address; // ?string
$result->consultationNumber; // ?string — issued only when a requester was given
$result->checkedAt; // DateTimeImmutable, UTC
use IdSign\BusinessRegisters\Vies\MatchResult;
use IdSign\BusinessRegisters\Vies\TraderDetails;
$result = $vies->check('ESA15075062', trader: new TraderDetails(
name: 'Industria de Diseño Textil, S.A.',
city: 'Arteixo',
));
$result->nameMatch; // ?MatchResult — Valid, Invalid or NotProcessed
$result->streetMatch; // ?MatchResult — likewise postalCodeMatch, cityMatch, companyTypeMatch
use IdSign\BusinessRegisters\Isir\InsolvencyClient;
$isir = new InsolvencyClient($http);
$proceedings = $isir->find('25083325'); // InsolvencyProceedings; empty when the subject is not listed
$proceedings->hasOngoing(); // true
$proceedings->ongoing(); // list<InsolvencyProceeding>
$proceedings->synchronisedAt; // ?DateTimeImmutable — how fresh the register data are
foreach ($proceedings as $proceeding) { // also $proceedings->proceedings, count($proceedings)
$proceeding->reference(); // "95 INS 12575/2022"
$proceeding->isOngoing(); // true
$proceeding->stateCode; // ?string, e.g. "KONKURS"
$proceeding->insolvencyDeclaredOn; // ?DateTimeImmutable — decision on insolvency took legal force
$proceeding->endedOn; // ?DateTimeImmutable — end of the proceeding took legal force
}
$isir->findByBirthNumber('000000/0000'); // exact match on the birth number, with or without the slash
$isir->findByNameAndBirthDate('Nováková', 'Jana', new \DateTimeImmutable('1980-01-01')); // all three must match exactly, case-insensitive
use IdSign\BusinessRegisters\Exception\InvalidInput;
use IdSign\BusinessRegisters\Exception\InvalidResponse;
use IdSign\BusinessRegisters\Exception\ServiceUnavailable;
try {
$profile = $lookup->byCompanyId($input, Section::Vat);
} catch (InvalidInput $e) {
// show a validation error; $e->errorCode may hold the source's code
} catch (ServiceUnavailable $e) {
// retry later; $e->source says which register
} catch (InvalidResponse $e) {
// log and report; $e->source and $e->errorCode, the message names the key path
}
use IdSign\BusinessRegisters\Ares\AresRegister;
use IdSign\BusinessRegisters\Ares\Companies;
use IdSign\BusinessRegisters\Ares\Company;
use IdSign\BusinessRegisters\Ares\CompanyDirectory;
use IdSign\BusinessRegisters\Ares\Registrations;
use IdSign\BusinessRegisters\Ares\RegistrationStatus;
use IdSign\BusinessRegisters\CompanyId;
$company = new Company(
aresId: '45274649',
id: CompanyId::parse('45274649'),
name: 'Test s.r.o.',
legalFormCode: '112',
vatId: null,
groupVatId: null,
taxOfficeCode: null,
seat: null,
deliveryAddressLines: [],
establishedOn: null,
ceasedOn: null,
updatedOn: null,
naceCodes: [],
naceCodes2008: [],
fileNumber: null,
primarySource: null,
registrations: new Registrations([AresRegister::Vat->value => RegistrationStatus::Active]),
);
$directory = $this->createStub(CompanyDirectory::class); // PHPUnit
$directory->method('findMany')->willReturn(new Companies([$company]));
use IdSign\BusinessRegisters\CompanyProfile;
use IdSign\BusinessRegisters\Section;
use IdSign\BusinessRegisters\SectionStatus;
$profile = new CompanyProfile(
company: $company,
vat: null,
vies: null,
insolvencies: null,
statuses: [Section::Vat->name => SectionStatus::Unavailable],
errors: [],
);
use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\HttpClient\Response\MockResponse;
$client = new AresClient(new MockHttpClient(new MockResponse($json, ['http_code' => 200])));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.