Lue dans les fichiers PHP du paquet au commit 871a3b3d24ee : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
OmnistateclassWhat states and registries know, asked of whichever registry installed answers for it: a company by its identifier, a VAT number, a domain, a network. Answers are kept $ttl seconds when a cache is given - registers change slowly, and some count their calls.
14 methods
CompanySearchclassCompanies found by name (or number), as the search field and its endpoint hand them out: one flat row each, with what a form may fill - the SIREN, the head office's SIRET and address, and the French intra-EU VAT number derived from the SIREN (VIES still has the last word on it).
3 methods · 2 constants
OmnistateBundleclassOmnistate in a Symfony application: Omnistate\Omnistate autowired, every registry package installed (omnistate/vies, omnistate/annuaire-entreprises, omnistate/iana) registered, answers kept in a cache pool, and the #[Siren], #[Siret] and #[VatNumber] constraints, and the company search: CompanySearchType (a form field that fills its siblings from the company picked) asking CompanySearchController (GET /omnistate/company/search, routed by importing Bridge/Symfony/Controller/ as attributes).
4 methods
Omnistate\Bridge\Symfony\Controller
CompanySearchControllerclassGET /omnistate/company/search?q=la touche originale[&limit=10]: {results: [...]} (CompanySearch::row()), 503 when no registry answers.
2 methods
CompanySearchTypeclassA company search field: type a name (or a SIREN), pick a company among the register's, and the sibling fields named in `fill` take its details.
5 methods
Omnistate\Bridge\Symfony\Validator
FinessclassA French health or social facility's FINESS number: nine characters, its Luhn key right.
1 method · 1 property
FinessValidatorclass1 method
RppsclassA French health professional's RPPS number: eleven digits, its Luhn key right (its IDNPS form, 8 + RPPS, too).
1 method · 1 property
RppsValidatorclass1 method
SirenclassA French SIREN: nine digits, its Luhn key right.
1 method · 1 property
SirenValidatorclass1 method
SiretclassA French SIRET: fourteen digits, its key right (La Poste's too).
1 method · 1 property
SiretValidatorclass1 method
VatNumberclassAn intra-EU VAT number: in its member state's shape (and, for France, its key agreeing with its SIREN) - and, with $checkExistence, known to VIES.
1 method · 3 properties
VatNumberValidatorclass2 methods
NotSupportedExceptionclassNo registry installed answers for that: add its package (omnistate/...).
OmnistateExceptionclassUnavailableExceptionclassThe register did not answer: down, overloaded, a member state's service closed for the night (VIES), too many calls (then $retryAfter, in seconds).
1 method · 1 property
RedactionclassWhat a failed call may carry of its credentials, taken out before the failure leaves the package: an HTTP client's exception quotes the URL called (a key in its query, a password in its user part), and every exception's trace keeps the arguments of the calls under it (the request options, headers and query with the key) unless PHP runs with zend.exception_ignore_args.
5 methods · 1 constant
CountryCodeclassISO 3166-1 country codes: registers write them with three letters (INSEE: "FRA") or two; Omnistate keeps two. No network.
3 methods · 1 constant
FinessclassA French health or social establishment's FINESS number: nine characters, the department first (two digits, or 2A / 2B for Corsica), the last a Luhn check digit over the eight before it. A legal entity (FINESS juridique) and each of its sites (FINESS géographique) have one each.
3 methods
LuhnclassThe Luhn check (ISO/IEC 7812): every second digit from the right doubled.
1 method
RppsclassA French health professional's RPPS number (Répertoire partagé des professionnels de santé): eleven digits, the last a Luhn check digit. Its national form, the IDNPS, is "8" followed by the RPPS. No register is asked: a number can be well written and still belong to no one.
4 methods
SirenclassA French company's SIREN: nine digits, the last a Luhn check digit. No register is asked: a SIREN can be well written and still belong to no one.
3 methods
SiretclassA French establishment's SIRET: its company's SIREN and a five-digit NIC, fourteen digits under a Luhn check - La Poste's (SIREN 356 000 000) also when the sum of their digits is a multiple of 5, the rule its many establishments' numbers follow (its head office, 356 000 000 00048, passes Luhn and not the sum).
3 methods
VatNumberclassIntra-EU VAT numbers, as VIES writes them: a country prefix (Greece is EL, Northern Ireland XI) and the number, in each country's own shape. No register is asked here - a number can be well written and belong to no one: omnistate/vies says whether it exists.
3 methods · 1 constant
ActivityclassWhat a company does, in its classification (France: NAF rev. 2, e.g. 62.02A).
2 methods · 4 properties
AddressclassWhere a company or an establishment is, as its register writes it.
2 methods · 7 properties
ArchiveclassWho keeps the original, and under which reference: what a citation needs.
2 methods · 4 properties
CivilPersonclassSomeone named in a civil record: the child and both parents of a birth, the spouses of a marriage, the deceased. Whatever the register does not tell is null.
4 methods · 11 properties
CivilQueryclassWhat is asked of a civil register: someone's name, and whatever narrows it down. A register uses what it can search on and ignores the rest - but it says beforehand, with supports(), whether the question is one for it (its country, its kinds of records).
7 methods · 11 properties
CivilRecordclassAn act, or a document about a person, as a public register indexes it: what it is, when, where, who is named in it, who keeps the original and - when the register gives them - the pictures of it. $raw keeps the register's whole answer.
3 methods · 14 properties
CivilRecordKindenumWhat a civil record records. OTHER is everything a register holds about a person that is not one of the five acts: a population register, a notarial deed, a catalogue entry of an archive.
1 method · 6 cases
CompanyclassA company as its register knows it. Whatever the source could not tell is null or empty; $raw keeps its whole answer, for what this model leaves out.
3 methods · 24 properties
CompanyStatusenum2 cases
ContactclassSomeone a registry names (a registrar, a registrant), as far as it shows them.
2 methods · 7 properties
DomainclassA domain name as its registry's RDAP server describes it.
1 method · 13 properties
EstablishmentclassOne of a company's places of business (France: a SIRET).
2 methods · 10 properties
FacilityclassA health or social facility as its register knows it (France: FINESS, through the Annuaire Santé): a hospital, a health centre, a pharmacy, a multi-professional practice.
2 methods · 13 properties
FinancialYearclassA year's accounts as the register publishes them, in the currency's major unit.
1 method · 4 properties
HeadcountclassHow many employees, as the register gives it: a range, and the year it was counted.
3 methods · 4 properties
LegalFormclassA legal form: the register's code, its name and the short name people use (SARL, SAS).
2 methods · 3 properties
ManagerclassWho runs a company: a person, or a company of its own (then its identifier).
2 methods · 7 properties
NetworkclassAn IP range or an autonomous system, as its regional registry's RDAP server describes it.
1 method · 15 properties
PartialDateclassA date as a register knows it: often whole, sometimes a year and a month, sometimes a year alone ("born in 1932"). What is not known is null - never a 1st of January made up.
9 methods · 3 properties
PeriodclassBetween two dates, either of them open: "from 1970", "1850 to 1860", "in 1853".
10 methods · 2 properties
PlaceclassWhere an act was drawn up, where someone was born: as much as the register tells.
2 methods · 8 properties
ProfessionalclassA regulated professional as their register knows them: a physician, a nurse, a physiotherapist (France: the RPPS, through the Annuaire Santé); later a lawyer (the CNB's directory). Whatever the source could not tell is null or empty; $raw keeps its whole answer.
3 methods · 16 properties
QualificationclassA coded qualification as a register writes it: a profession, a specialty, a diploma, a know-how (France: the ANS's nomenclatures, TRE_G15 for the professions, TRE_R38 for the medical specialties...).
2 methods · 3 properties
Sexenum1 method · 3 cases
VatCheckclassWhat a VAT register answered about a number: valid or not, and whose. The consultation number, when the check was made with the requester's own VAT number, is the proof it was made that day - to keep with a reverse-charge invoice.
2 methods · 7 properties
WorkplaceclassWhere and how a professional practises: a practice, a health centre, a hospital - its name and address, the facility's identifier when it has one (France: its FINESS), the mode of practice (self-employed, salaried) and the role held there.
2 methods · 8 properties
CivilRegistryInterfaceinterfaceA public register of acts and documents about people: a country's deaths file (France: INSEE's, through matchID), the indexes of its archives (the Netherlands and Belgium: Open Archives), an archive's catalogue. Each one says what it covers - which countries, which kinds of records, which years - so that a search screen can tell before asking.
8 methods
CompanyRegistryInterfaceinterfaceA register of companies: France's, the UK's Companies House.
4 methods
FacilityRegistryInterfaceinterfaceA register of health and social facilities (France: FINESS). A professional registry that knows them too implements both interfaces.
3 methods
InternetRegistryInterfaceinterfaceThe Internet's registries: domains, IP ranges, autonomous systems.
3 methods
ProfessionalRegistryInterfaceinterfaceA register of regulated professionals: France's health professionals (RPPS, through the Annuaire Santé), later its lawyers (the CNB). One contract for every profession: whoever reads it need not know which.
4 methods
VatRegistryInterfaceinterfaceA register of VAT numbers: the EU's VIES.
3 methods
RegistryContractTeststraitWhat every Omnistate register does, as PHPUnit tests, offline: a provider's test case uses this trait, gives its registry (built on the HTTP client the suite hands it) and the register's recorded answers. The suite checks each of the family's contracts the registry implements (CompanyRegistryInterface, VatRegistryInterface, ProfessionalRegistryInterface, FacilityRegistryInterface, CivilRegistryInterface, InternetRegistryInterface), asked through the Omnistate facade as an application asks:
5 methods
Omnistate
Omnistate class
final class Omnistate Omnistate.php:42
What states and registries know, asked of whichever registry installed answers for it: a company by its identifier, a VAT number, a domain, a network. Answers are kept $ttl seconds when a cache is given - registers change slowly, and some count their calls.
$omnistate->company('901821074')?->name; // "GLITCH ART" $omnistate->vat('FR53901821074')->valid; // true $omnistate->domain('glitchr.dev')?->registrar; // Gandi SAS $omnistate->professional('10003461033')?->profession; // Médecin (an RPPS number) $omnistate->facility('670001234')?->name; // a FINESS number $omnistate->civilRecords(new CivilQuery(familyName: 'Chirac', born: Period::year(1932))); // acts and documents about a person
Omnistate::__construct()
public function __construct(iterable $companies = [], iterable $vat = [], readonly ?InternetRegistryInterface $internet = null, readonly ?CacheInterface $cache = null, readonly int $ttl = 86400, readonly ?string $requester = null, iterable $professionals = [], iterable $civil = [])$professionalsregisters of regulated professionals (and their facilities)
$civilregisters of acts and documents about people (births, marriages, deaths, archives)
Omnistate::company()
public function company(string $identifier): ?CompanyA company by its identifier: a SIREN, a SIRET (its establishment among its establishments), a French VAT number (its SIREN).
..
- Throws
NotSupportedException no registry installed knows that kind of identifier
Omnistate::search()
public function search(string $query, int $limit = 10): array- Returns
from every company registry installed, the first that finds any
Omnistate::vat()
public function vat(string $number, ?string $requester = null): VatCheckWhether a VAT number exists, and whose. A number no member state writes that way is not valid, without asking anyone.
$requesteryour own VAT number, for a consultation number
- Throws
NotSupportedException no VAT registry installed answers for its country
Omnistate::professional()
public function professional(string $identifier): ?ProfessionalA regulated professional by their identifier: an RPPS number (or its IDNPS form, "8" + RPPS).
..
- Throws
NotSupportedException no professional registry installed knows that kind of identifier
Omnistate::professionals()
public function professionals(string $name, ?string $postcode = null, int $limit = 10): array- Returns
from every professional registry installed, the first that finds any
Omnistate::facility()
public function facility(string $identifier): ?FacilityA health or social facility by its identifier (a FINESS number), asked of the professional registries that know facilities too.
- Throws
NotSupportedException
Omnistate::civilRegistries()
public function civilRegistries(?string $country = null, ?CivilRecordKind $kind = null): arrayThe civil registers installed, those that hold records of that country (ISO 3166-1 alpha-2) and of that kind when given.
Omnistate::civilRegistry()
public function civilRegistry(string $name): ?CivilRegistryInterfaceThe civil register of that name, null when it is not installed.
Omnistate::civilCountries()
public function civilCountries(): array- Returns
ISO 3166-1 alpha-2 codes of the countries some civil register installed covers, sorted
Omnistate::civilRecords()
public function civilRecords(CivilQuery $query, ?string $registry = null): arrayActs and documents about a person. Asked of one register when it is named, else of every register installed the question is one for - their answers one after the other, in the order the registers were given.
A register that does not answer throws: asking them all, one that is down takes the others' answers with it. A screen that must keep what the others found asks them one by one (civilRegistries(), then this with each name).
- Throws
NotSupportedException no civil registry installed takes that question
- Throws
Omnistate\Exception\UnavailableException a register did not answer
Omnistate::civilRecord()
public function civilRecord(string $registry, string $identifier): ?CivilRecordA civil record found again: the register's name (CivilRecord::$source) and its identifier there (CivilRecord::$identifier). Often more complete than the line a search gave: everyone named in the act, its pictures.
- Throws
NotSupportedException that register is not installed
Omnistate::domain()
public function domain(string $name): ?DomainOmnistate::network()
public function network(string $address): ?NetworkAn IP address's range, or an AS number's.
Omnistate\Bridge\Symfony
CompanySearch class
final class CompanySearch CompanySearch.php:16
Companies found by name (or number), as the search field and its endpoint hand them out: one flat row each, with what a form may fill - the SIREN, the head office's SIRET and address, and the French intra-EU VAT number derived from the SIREN (VIES still has the last word on it).
const MIN_LENGTH = 3const MAX_RESULTS = 25
CompanySearch::__construct()
public function __construct(readonly Omnistate $omnistate)CompanySearch::search()
public function search(string $query, int $limit = 10): array- Throws
OmnistateException when no registry answers
CompanySearch::row()
public static function row(Company $company): arrayOmnistateBundle class
final class OmnistateBundle extends AbstractBundle OmnistateBundle.php:62
Omnistate in a Symfony application: Omnistate\Omnistate autowired, every registry package installed (omnistate/vies, omnistate/annuaire-entreprises, omnistate/iana) registered, answers kept in a cache pool, and the #[Siren], #[Siret] and #[VatNumber] constraints, and the company search: CompanySearchType (a form field that fills its siblings from the company picked) asking CompanySearchController (GET /omnistate/company/search, routed by importing Bridge/Symfony/Controller/ as attributes).
omnistate: cache: cache.app # null: every call asks the registry ttl: 86400 timeout: 10 requester: FR53901821074 # your VAT number: VIES answers a consultation number annuaire_sante: api_key: '%env(ESANTE_API_KEY)%' # omnistate/annuaire-sante: health professionals (RPPS) and facilities (FINESS)
matchid:
token: '%env(MATCHID_TOKEN)%' # omnistate/matchid: optional, a higher quotanara:
api_key: '%env(NARA_API_KEY)%' # omnistate/nara: the US National Archives Catalog, 10,000 calls a monthCivil registers (omnistate/matchid, omnistate/openarchieven, omnistate/national-archives-uk, omnistate/nara) are registered when installed and tagged omnistate.civil_registry.
An application's own registries (a CompanyRegistryInterface...) are asked too, autoconfigured.
OmnistateBundle::getPath()
public function getPath(): stringThis directory: its templates/ are @Omnistate (the default is two levels up).
OmnistateBundle::prependExtension()
public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): voidThe company search field's widget, in every form theme.
OmnistateBundle::configure()
public function configure(DefinitionConfigurator $definition): voidOmnistateBundle::loadExtension()
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): voidOmnistate\Bridge\Symfony\Controller
CompanySearchController class
class CompanySearchController CompanySearchController.php:19
GET /omnistate/company/search?q=la touche originale[&limit=10]: {results: [...]} (CompanySearch::row()), 503 when no registry answers.
What the company search field asks; answers are kept by Omnistate's cache.
Routed by importing the directory (type: attribute), or by a subclass in a directory already imported - base-bundle-market does, so every shop has it.
CompanySearchController::__construct()
public function __construct(readonly CompanySearch $companies)CompanySearchController::__invoke()
public function __invoke(Request $request): JsonResponseOmnistate\Bridge\Symfony\Form
CompanySearchType class
final class CompanySearchType extends AbstractType CompanySearchType.php:27
A company search field: type a name (or a SIREN), pick a company among the
register's, and the sibling fields named in fill take its details.
$builder->add('company', CompanySearchType::class, [ 'fill' => ['vatNumber' => 'vatNumber', 'companyName' => 'name', 'address' => 'address'], ]);
fill maps a sibling field of the same form to a result key
(CompanySearch::row(): siren, siret, name, vatNumber, address, postalCode,
city, activity, legalForm...). Not mapped by default: it only helps fill
the others. The suggestions come from endpoint (by default the route
omnistate_company_search); the widget's script is in the form theme.
CompanySearchType::__construct()
public function __construct(readonly ?UrlGeneratorInterface $urlGenerator = null)CompanySearchType::configureOptions()
public function configureOptions(OptionsResolver $resolver): voidCompanySearchType::getParent()
public function getParent(): stringCompanySearchType::getBlockPrefix()
public function getBlockPrefix(): stringCompanySearchType::finishView()
public function finishView(FormView $view, FormInterface $form, array $options): voidOmnistate\Bridge\Symfony\Validator
Finess class
final class Finess extends Constraint Finess.php:8
A French health or social facility's FINESS number: nine characters, its Luhn key right.
public string $message = 'This is not a valid FINESS number.'
Finess::__construct()
public function __construct(?string $message = null, ?array $groups = null, mixed $payload = null)FinessValidator class
final class FinessValidator extends ConstraintValidator FinessValidator.php:10
FinessValidator::validate()
public function validate(mixed $value, Constraint $constraint): voidRpps class
final class Rpps extends Constraint Rpps.php:8
A French health professional's RPPS number: eleven digits, its Luhn key right (its IDNPS form, 8 + RPPS, too).
public string $message = 'This is not a valid RPPS number.'
Rpps::__construct()
public function __construct(?string $message = null, ?array $groups = null, mixed $payload = null)RppsValidator class
final class RppsValidator extends ConstraintValidator RppsValidator.php:10
RppsValidator::validate()
public function validate(mixed $value, Constraint $constraint): voidSiren class
final class Siren extends Constraint Siren.php:8
A French SIREN: nine digits, its Luhn key right.
public string $message = 'This is not a valid SIREN.'
Siren::__construct()
public function __construct(?string $message = null, ?array $groups = null, mixed $payload = null)SirenValidator class
final class SirenValidator extends ConstraintValidator SirenValidator.php:10
SirenValidator::validate()
public function validate(mixed $value, Constraint $constraint): voidSiret class
final class Siret extends Constraint Siret.php:8
A French SIRET: fourteen digits, its key right (La Poste's too).
public string $message = 'This is not a valid SIRET.'
Siret::__construct()
public function __construct(?string $message = null, ?array $groups = null, mixed $payload = null)SiretValidator class
final class SiretValidator extends ConstraintValidator SiretValidator.php:10
SiretValidator::validate()
public function validate(mixed $value, Constraint $constraint): voidVatNumber class
final class VatNumber extends Constraint VatNumber.php:12
An intra-EU VAT number: in its member state's shape (and, for France, its key agreeing with its SIREN) - and, with $checkExistence, known to VIES.
VIES down is not a wrong number: the value then passes.
public string $message = 'This is not a valid EU VAT number.'public string $unknownMessage = 'No EU member state knows this VAT number.'public bool $checkExistence
VatNumber::__construct()
public function __construct(public bool $checkExistence = false, ?string $message = null, ?string $unknownMessage = null, ?array $groups = null, mixed $payload = null)VatNumberValidator class
final class VatNumberValidator extends ConstraintValidator VatNumberValidator.php:12
VatNumberValidator::__construct()
public function __construct(readonly ?Omnistate $omnistate = null)VatNumberValidator::validate()
public function validate(mixed $value, Constraint $constraint): voidOmnistate\Exception
NotSupportedException class
class NotSupportedException extends OmnistateException NotSupportedException.php:6
No registry installed answers for that: add its package (omnistate/...).
OmnistateException class
class OmnistateException extends RuntimeException OmnistateException.php:5
UnavailableException class
class UnavailableException extends OmnistateException UnavailableException.php:12
The register did not answer: down, overloaded, a member state's service closed for the night (VIES), too many calls (then $retryAfter, in seconds).
Not an answer about the company or the number: ask again later. HTTP 401, 403, 429, 5xx, no answer and an unreadable one are all this (the family's rule, docs/providers.md), never null nor an empty list.
UnavailableException::__construct()
public function __construct(string $message, public readonly ?int $retryAfter = null, ?\Throwable $previous = null)Omnistate\Http
Redaction class
final class Redaction Redaction.php:22
What a failed call may carry of its credentials, taken out before the failure leaves the package: an HTTP client's exception quotes the URL called (a key in its query, a password in its user part), and every exception's trace keeps the arguments of the calls under it (the request options, headers and query with the key) unless PHP runs with zend.exception_ignore_args.
copy() gives the previous exception to wrap instead of the client's own: the same class and code, its message with the key's parameters, the user part and every secret value replaced by ***, its trace without arguments, its own previous copied the same way. Properties of the client's class beyond those of \Exception are not copied (a Symfony HttpException's response, a PSR-18 exception's request: their URL holds the key). withoutArguments() takes the arguments out of the trace of the exception thrown in its place.
const MASK = '***'
Redaction::secrets()
public static function secrets(string $url, array $options = []): arrayThe secrets a request carries: the values of its query parameters, headers and body fields named as credentials (key, token, secret, password, signature, auth...), a bearer token, a basic password, the URL's user part.
$optionsthe HTTP client's options
Redaction::sensitive()
public static function sensitive(string $name): boolWhether a parameter, header or field of this name holds a credential.
Redaction::text()
public static function text(string $text, array $secrets = []): stringA text without credentials: in every address, the user part and the parameters named as credentials masked (api_key=***); then every secret given, raw or URL-encoded, masked wherever it stands.
Redaction::copy()
public static function copy(\Throwable $failure, array $secrets = []): \ThrowableA copy of a failure to wrap in its place: its class, code, file and line, its message through text(), its trace without arguments, its previous copied the same way.
Redaction::withoutArguments()
public static function withoutArguments(\Throwable $failure): \ThrowableThe failure given, the arguments out of its trace (and out of its previous ones'), as zend.exception_ignore_args would have left it.
Omnistate\Identifier
CountryCode class
final class CountryCode CountryCode.php:9
ISO 3166-1 country codes: registers write them with three letters (INSEE: "FRA") or two; Omnistate keeps two. No network.
const ALPHA3 = ['AFG' => 'AF', 'ALA' => 'AX', 'ALB' => 'AL', 'DZA' => 'DZ', 'ASM' => 'AS', 'AND' => 'AD', 'AGO' => 'AO', 'AIA' => 'AI', 'ATA' => 'AQ', 'ATG' => 'AG', 'ARG' …alpha-3 => alpha-2, the 249 codes officially assigned.
CountryCode::alpha2()
public static function alpha2(?string $code): ?stringThe alpha-2 code of a two- or three-letter code, null when it is neither.
CountryCode::alpha3()
public static function alpha3(?string $code): ?stringCountryCode::isValid()
public static function isValid(?string $code): boolFiness class
final class Finess Finess.php:11
A French health or social establishment's FINESS number: nine characters, the department first (two digits, or 2A / 2B for Corsica), the last a Luhn check digit over the eight before it. A legal entity (FINESS juridique) and each of its sites (FINESS géographique) have one each.
Finess::normalize()
public static function normalize(?string $finess): ?string"67 000 123 4" -> "670001234"; null when it is not nine characters of that shape.
Finess::isValid()
public static function isValid(?string $finess): boolNine characters whose last checks the eight before it (Luhn). Corsica's letters count as 0 (2A) and 1 (2B), the way the register computes its key.
Finess::department()
public static function department(string $finess): ?stringThe department the number was given in: "67", "2A".
Luhn class
final class Luhn Luhn.php:6
The Luhn check (ISO/IEC 7812): every second digit from the right doubled.
Luhn::isValid()
public static function isValid(string $digits): boolRpps class
final class Rpps Rpps.php:11
A French health professional's RPPS number (Répertoire partagé des professionnels de santé): eleven digits, the last a Luhn check digit. Its national form, the IDNPS, is "8" followed by the RPPS. No register is asked: a number can be well written and still belong to no one.
Rpps::normalize()
public static function normalize(?string $rpps): ?string"100 0346 1033" or the IDNPS "810003461033" -> "10003461033"; null when it is neither.
Rpps::isValid()
public static function isValid(?string $rpps): boolEleven digits whose last checks the ten others (Luhn).
Rpps::toIdnps()
public static function toIdnps(string $rpps): stringThe national identifier the Annuaire Santé and Pro Santé Connect use: "8" + RPPS.
Rpps::withKey()
public static function withKey(string $tenDigits): stringA valid number from its first ten digits (fixtures, tests): the Luhn key appended.
Siren class
final class Siren Siren.php:9
A French company's SIREN: nine digits, the last a Luhn check digit. No register is asked: a SIREN can be well written and still belong to no one.
Siren::normalize()
public static function normalize(?string $siren): ?string"901 821 074" -> "901821074"; null when it is not nine digits.
Siren::isValid()
public static function isValid(?string $siren): boolSiren::toVatNumber()
public static function toVatNumber(string $siren): stringThe French intra-EU VAT number of that SIREN: FR + ((12 + 3 × (SIREN mod 97)) mod 97) + SIREN.
Siret class
final class Siret Siret.php:12
A French establishment's SIRET: its company's SIREN and a five-digit NIC, fourteen digits under a Luhn check - La Poste's (SIREN 356 000 000) also when the sum of their digits is a multiple of 5, the rule its many establishments' numbers follow (its head office, 356 000 000 00048, passes Luhn and not the sum).
Siret::normalize()
public static function normalize(?string $siret): ?string"901 821 074 00019" -> "90182107400019"; null when it is not fourteen digits.
Siret::isValid()
public static function isValid(?string $siret): boolSiret::siren()
public static function siren(string $siret): stringVatNumber class
final class VatNumber VatNumber.php:11
Intra-EU VAT numbers, as VIES writes them: a country prefix (Greece is EL, Northern Ireland XI) and the number, in each country's own shape. No register is asked here - a number can be well written and belong to no one: omnistate/vies says whether it exists.
const FORMATS = ['AT' => 'U\d{8}', 'BE' => '[01]\d{9}', 'BG' => '\d{9,10}', 'CY' => '\d{8}[A-Z]', 'CZ' => '\d{8,10}', 'DE' => '\d{9}', 'DK' => '\d{8}', 'EE' => '\d{9}', 'EL'…Each member state's shape, after its prefix.
VatNumber::normalize()
public static function normalize(?string $number): ?string"de 123 456-789" -> "DE123456789", "GR..." -> "EL...", and a SIREN or SIRET -> its French number; null when it has no member state's shape.
VatNumber::isWellFormed()
public static function isWellFormed(?string $number): boolWell written, and for France its key agrees with its SIREN.
VatNumber::country()
public static function country(string $number): stringOmnistate\Model
Activity class
final readonly class Activity Activity.php:6
What a company does, in its classification (France: NAF rev. 2, e.g. 62.02A).
public string $codepublic string $classificationpublic ?string $labelpublic ?string $sectionThe classification's section (the NAF's letter, J for IT).
Activity::__construct()
public function __construct(public string $code, public string $classification, public ?string $label = null, public ?string $section = null)Activity::__toString()
public function __toString(): stringAddress class
final readonly class Address Address.php:6
Where a company or an establishment is, as its register writes it.
public ?string $streetpublic ?string $postalCodepublic ?string $citypublic ?string $countryISO 3166-1 alpha-2.
public ?string $fullThe register's own one-line form.
public ?float $latitudepublic ?float $longitude
Address::__construct()
public function __construct(public ?string $street = null, public ?string $postalCode = null, public ?string $city = null, public ?string $country = null, public ?string $full = null, public ?float $latitude = null, public ?float $longitude = null)Address::__toString()
public function __toString(): stringArchive class
final readonly class Archive implements Stringable Archive.php:6
Who keeps the original, and under which reference: what a citation needs.
public string $name"Brabants Historisch Informatie Centrum", "INSEE", "The National Archives, Kew".
public ?string $codeThe register's code for it ("bhi").
public ?string $referenceThe call number: fonds, register, folio, act number.
public ?string $urlThe record at the archive itself.
Archive::__construct()
public function __construct(public string $name, public ?string $code = null, public ?string $reference = null, public ?string $url = null)Archive::__toString()
public function __toString(): stringCivilPerson class
final readonly class CivilPerson implements Stringable CivilPerson.php:10
Someone named in a civil record: the child and both parents of a birth, the spouses of a marriage, the deceased. Whatever the register does not tell is null.
public string $familyNamepublic array $givenNamespublic Sex $sexpublic ?string $roleAs the register writes it: "Child", "Father", "Bride", "Deceased", "Witness".
..
public ?PartialDate $birthDatepublic ?Place $birthPlacepublic ?PartialDate $deathDatepublic ?Place $deathPlacepublic ?int $ageAt the event, in years.
public ?string $professionpublic ?string $fullNameThe whole name, when the register gives it in one piece only.
CivilPerson::__construct()
public function __construct(public string $familyName = '', public array $givenNames = [], public Sex $sex = Sex::UNKNOWN, public ?string $role = null, public ?PartialDate $birthDate = null, public ?Place $birthPlace = null, public ?PartialDate $deathDate = null, public ?Place $deathPlace = null, public ?int $age = null, public ?string $profession = null, public ?string $fullName = null)CivilPerson::name()
public function name(): string"Jacques René Chirac"
CivilPerson::givenName()
public function givenName(): ?stringCivilPerson::__toString()
public function __toString(): stringCivilQuery class
final readonly class CivilQuery CivilQuery.php:13
What is asked of a civil register: someone's name, and whatever narrows it down. A register uses what it can search on and ignores the rest - but it says beforehand, with supports(), whether the question is one for it (its country, its kinds of records).
new CivilQuery(familyName: 'Chirac', givenName: 'Jacques', born: Period::year(1932), country: 'FR')
public array $kindspublic ?string $countrypublic int $limitpublic int $pagepublic ?string $familyNamepublic ?string $givenNamepublic ?Period $bornpublic ?Period $diedpublic ?Period $datedWhen the event recorded took place, whatever it is.
public ?string $placeThe town of the event.
public ?Sex $sex
CivilQuery::__construct()
public function __construct(public ?string $familyName = null, public ?string $givenName = null, public ?Period $born = null, public ?Period $died = null, public ?Period $dated = null, public ?string $place = null, ?string $country = null, array $kinds = [], public ?Sex $sex = null, int $limit = 20, int $page = 1)$kindsthe kinds wanted; empty: any
$countryISO 3166-1 alpha-2 of the country whose registers are asked; null: any
CivilQuery::name()
public function name(): string"Jacques Chirac"
CivilQuery::hasName()
public function hasName(): boolCivilQuery::wants()
public function wants(CivilRecordKind $kind): boolCivilQuery::wantsAny()
public function wantsAny(CivilRecordKind ...$kinds): boolWhether any of these kinds is wanted.
CivilQuery::inCountries()
public function inCountries(string ...$countries): boolWhether a register of these countries may be asked.
CivilQuery::key()
public function key(): stringA key for a cache: the same question, the same key.
CivilRecord class
final readonly class CivilRecord CivilRecord.php:11
An act, or a document about a person, as a public register indexes it: what it is, when, where, who is named in it, who keeps the original and - when the register gives them - the pictures of it. $raw keeps the register's whole answer.
public string $identifierWhat Omnistate::civilRecord() takes to find it again in its register.
public CivilRecordKind $kindpublic string $sourceThe register it came from: "matchid", "openarchieven".
..
public ?PartialDate $dateOf the event (the birth, the death), not of the paper.
public ?Place $placepublic array $personspublic ?Archive $archivepublic ?string $urlThe record's page at the register.
public array $imagespublic ?string $titleWhat the register calls it: "Civil registration births", a catalogue title.
public ?string $numberThe act's number in its register.
public ?string $descriptionpublic ?Period $periodWhen the register dates it by a span ("1939-1945") rather than a day.
public array $raw
CivilRecord::__construct()
public function __construct(public string $identifier, public CivilRecordKind $kind, public string $source, public ?PartialDate $date = null, public ?Place $place = null, public array $persons = [], public ?Archive $archive = null, public ?string $url = null, public array $images = [], public ?string $title = null, public ?string $number = null, public ?string $description = null, public ?Period $period = null, public array $raw = [])CivilRecord::principal()
public function principal(): ?CivilPersonThe one the record is about.
CivilRecord::hasImages()
public function hasImages(): boolCivilRecordKind enum
enum CivilRecordKind CivilRecordKind.php:10
What a civil record records. OTHER is everything a register holds about a person that is not one of the five acts: a population register, a notarial deed, a catalogue entry of an archive.
case BIRTH = 'birth'case BAPTISM = 'baptism'case MARRIAGE = 'marriage'case DEATH = 'death'case BURIAL = 'burial'case OTHER = 'other'
CivilRecordKind::gedcom()
public function gedcom(): ?stringThe GEDCOM tag of the event it documents (BIRT, CHR, MARR, DEAT, BURI), null for OTHER.
Company class
final readonly class Company Company.php:9
A company as its register knows it. Whatever the source could not tell is null or empty; $raw keeps its whole answer, for what this model leaves out.
public string $identifierThe register's identifier (France: the SIREN).
public string $namepublic CompanyStatus $statuspublic string $countrypublic string $sourceWhere it came from: "annuaire-entreprises", "inpi".
..
public ?string $legalNamepublic ?string $acronympublic ?LegalForm $legalFormpublic ?Activity $activitypublic ?string $categoryThe size category (France: PME, ETI, GE) and its year.
public ?Headcount $headcountpublic ?\DateTimeImmutable $createdOnpublic ?\DateTimeImmutable $closedOnpublic ?Establishment $headOfficepublic array $establishmentspublic ?int $establishmentCountpublic ?int $openEstablishmentCountpublic array $managerspublic array $financespublic array $labelspublic array $collectiveAgreementspublic ?string $vatNumberpublic ?\DateTimeImmutable $updatedAtpublic array $raw
Company::__construct()
public function __construct(public string $identifier, public string $name, public CompanyStatus $status, public string $country, public string $source, public ?string $legalName = null, public ?string $acronym = null, public ?LegalForm $legalForm = null, public ?Activity $activity = null, public ?string $category = null, public ?Headcount $headcount = null, public ?\DateTimeImmutable $createdOn = null, public ?\DateTimeImmutable $closedOn = null, public ?Establishment $headOffice = null, public array $establishments = [], public ?int $establishmentCount = null, public ?int $openEstablishmentCount = null, public array $managers = [], public array $finances = [], public array $labels = [], public array $collectiveAgreements = [], public ?string $vatNumber = null, public ?\DateTimeImmutable $updatedAt = null, public array $raw = [])Company::isActive()
public function isActive(): boolCompany::establishment()
public function establishment(string $identifier): ?EstablishmentCompanyStatus enum
enum CompanyStatus CompanyStatus.php:5
case ACTIVE = 'active'case CLOSED = 'closed'
Contact class
final readonly class Contact Contact.php:6
Someone a registry names (a registrar, a registrant), as far as it shows them.
public ?string $namepublic ?string $organizationpublic ?string $emailpublic ?string $countrypublic ?string $handlepublic ?string $ianaIdA registrar's IANA ID.
public ?string $url
Contact::__construct()
public function __construct(public ?string $name = null, public ?string $organization = null, public ?string $email = null, public ?string $country = null, public ?string $handle = null, public ?string $ianaId = null, public ?string $url = null)Contact::__toString()
public function __toString(): stringDomain class
final readonly class Domain Domain.php:6
A domain name as its registry's RDAP server describes it.
public string $namepublic string $sourcepublic ?string $handlepublic array $statusespublic ?Contact $registrarpublic ?Contact $registrantNull when the registry does not publish it (most do not, since the GDPR).
public ?\DateTimeImmutable $registeredAtpublic ?\DateTimeImmutable $expiresAtpublic ?\DateTimeImmutable $changedAtpublic array $nameserverspublic bool $dnssecpublic ?string $serverThe server that answered.
public array $raw
Domain::__construct()
public function __construct(public string $name, public string $source, public ?string $handle = null, public array $statuses = [], public ?Contact $registrar = null, public ?Contact $registrant = null, public ?\DateTimeImmutable $registeredAt = null, public ?\DateTimeImmutable $expiresAt = null, public ?\DateTimeImmutable $changedAt = null, public array $nameservers = [], public bool $dnssec = false, public ?string $server = null, public array $raw = [])Establishment class
final readonly class Establishment Establishment.php:6
One of a company's places of business (France: a SIRET).
public string $identifierpublic bool $headOfficepublic CompanyStatus $statuspublic ?Address $addresspublic ?string $namepublic array $signspublic ?Activity $activitypublic ?Headcount $headcountpublic ?\DateTimeImmutable $createdOnpublic ?\DateTimeImmutable $closedOn
Establishment::__construct()
public function __construct(public string $identifier, public bool $headOffice, public CompanyStatus $status, public ?Address $address = null, public ?string $name = null, public array $signs = [], public ?Activity $activity = null, public ?Headcount $headcount = null, public ?\DateTimeImmutable $createdOn = null, public ?\DateTimeImmutable $closedOn = null)Establishment::isActive()
public function isActive(): boolFacility class
final readonly class Facility Facility.php:10
A health or social facility as its register knows it (France: FINESS, through the Annuaire Santé): a hospital, a health centre, a pharmacy, a multi-professional practice.
public string $identifierThe register's identifier (France: the FINESS number).
public string $namepublic string $sourcepublic ?string $kind"legal" (the entity) or "site" (one of its places), when the register says.
public array $typespublic ?Address $addresspublic array $phonespublic array $emailspublic array $secureEmailspublic array $identifierspublic bool $activepublic ?\DateTimeImmutable $updatedAtpublic array $raw
Facility::__construct()
public function __construct(public string $identifier, public string $name, public string $source, public ?string $kind = null, public array $types = [], public ?Address $address = null, public array $phones = [], public array $emails = [], public array $secureEmails = [], public array $identifiers = [], public bool $active = true, public ?\DateTimeImmutable $updatedAt = null, public array $raw = [])Facility::__toString()
public function __toString(): stringFinancialYear class
final readonly class FinancialYear FinancialYear.php:6
A year's accounts as the register publishes them, in the currency's major unit.
public int $yearpublic ?float $revenuepublic ?float $netIncomepublic string $currency
FinancialYear::__construct()
public function __construct(public int $year, public ?float $revenue = null, public ?float $netIncome = null, public string $currency = 'EUR')Headcount class
final readonly class Headcount Headcount.php:6
How many employees, as the register gives it: a range, and the year it was counted.
public ?int $minpublic ?int $maxpublic ?int $yearpublic ?string $codeThe register's own code for the range (INSEE: "12" for 20 to 49).
Headcount::__construct()
public function __construct(public ?int $min = null, public ?int $max = null, public ?int $year = null, public ?string $code = null)Headcount::isEmployer()
public function isEmployer(): boolHeadcount::__toString()
public function __toString(): stringLegalForm class
final readonly class LegalForm LegalForm.php:6
A legal form: the register's code, its name and the short name people use (SARL, SAS).
public string $codepublic ?string $labelpublic ?string $short
LegalForm::__construct()
public function __construct(public string $code, public ?string $label = null, public ?string $short = null)LegalForm::__toString()
public function __toString(): stringManager class
final readonly class Manager Manager.php:6
Who runs a company: a person, or a company of its own (then its identifier).
public string $namepublic ?string $rolepublic bool $personpublic ?string $firstNamespublic ?string $identifierA company that manages: its identifier (France: its SIREN).
public ?int $birthYearpublic ?string $nationality
Manager::__construct()
public function __construct(public string $name, public ?string $role = null, public bool $person = true, public ?string $firstNames = null, public ?string $identifier = null, public ?int $birthYear = null, public ?string $nationality = null)Manager::__toString()
public function __toString(): stringNetwork class
final readonly class Network Network.php:6
An IP range or an autonomous system, as its regional registry's RDAP server describes it.
public string $handlepublic string $sourcepublic ?string $namepublic ?string $type"ALLOCATED PA", "ASSIGNED PA", "DIRECT ALLOCATION".
..
public ?string $countrypublic ?string $startAddressAn IP range: its first and last address.
public ?string $endAddresspublic ?int $startAutnumAn autonomous system: its numbers.
public ?int $endAutnumpublic ?Contact $registrantpublic ?Contact $abusepublic ?\DateTimeImmutable $registeredAtpublic ?\DateTimeImmutable $changedAtpublic ?string $serverpublic array $raw
Network::__construct()
public function __construct(public string $handle, public string $source, public ?string $name = null, public ?string $type = null, public ?string $country = null, public ?string $startAddress = null, public ?string $endAddress = null, public ?int $startAutnum = null, public ?int $endAutnum = null, public ?Contact $registrant = null, public ?Contact $abuse = null, public ?\DateTimeImmutable $registeredAt = null, public ?\DateTimeImmutable $changedAt = null, public ?string $server = null, public array $raw = [])PartialDate class
final readonly class PartialDate implements Stringable PartialDate.php:10
A date as a register knows it: often whole, sometimes a year and a month, sometimes a year alone ("born in 1932"). What is not known is null - never a 1st of January made up.
public ?int $yearpublic ?int $month1 to 12
public ?int $day
PartialDate::__construct()
public function __construct(public ?int $year = null, public ?int $month = null, public ?int $day = null)PartialDate::parse()
public static function parse(?string $value): ?self"1932-11-29", "19321129", "29/11/1932", "1932-11", "1932", and the registers' unknown parts written as zeros ("19320000"); null when no year can be read.
PartialDate::of()
public static function of(?int $year, ?int $month = null, ?int $day = null): ?selfZeros and out-of-range parts are unknown parts; no year, no date.
PartialDate::fromDate()
public static function fromDate(\DateTimeInterface $date): selfPartialDate::isComplete()
public function isComplete(): boolPartialDate::toDate()
public function toDate(): ?\DateTimeImmutableThe day itself when it is whole, null otherwise.
PartialDate::earliest()
public function earliest(): ?\DateTimeImmutableThe first day it can be.
PartialDate::latest()
public function latest(): ?\DateTimeImmutableThe last day it can be.
PartialDate::__toString()
public function __toString(): stringISO 8601, as far as it is known: "1932-11-29", "1932-11", "1932".
Period class
final readonly class Period implements Stringable Period.php:6
Between two dates, either of them open: "from 1970", "1850 to 1860", "in 1853".
public ?PartialDate $frompublic ?PartialDate $to
Period::__construct()
public function __construct(public ?PartialDate $from = null, public ?PartialDate $to = null)Period::year()
public static function year(int $year): selfPeriod::years()
public static function years(?int $from, ?int $to): selfPeriod::since()
public static function since(int $year): selfPeriod::around()
public static function around(int $year, int $margin = 2): selfA year give or take a few: the way a genealogist searches a birth.
Period::day()
public static function day(PartialDate $date): selfPeriod::isDay()
public function isDay(): boolOne date, whole, at both ends.
Period::isYear()
public function isYear(): boolPeriod::contains()
public function contains(PartialDate $date): boolPeriod::__toString()
public function __toString(): stringPlace class
final readonly class Place implements Stringable Place.php:6
Where an act was drawn up, where someone was born: as much as the register tells.
public ?string $nameThe town, as the register writes it.
public ?string $codeThe register's own code for it (France: the INSEE commune code).
public ?string $postcodepublic ?string $regionA subdivision: a French département's code, a province.
public ?string $countryISO 3166-1 alpha-2.
public ?string $countryNameThe country as the register writes it, when it gives no code we know.
public ?float $latitudepublic ?float $longitude
Place::__construct()
public function __construct(public ?string $name = null, public ?string $code = null, public ?string $postcode = null, public ?string $region = null, public ?string $country = null, public ?string $countryName = null, public ?float $latitude = null, public ?float $longitude = null)Place::__toString()
public function __toString(): stringProfessional class
final readonly class Professional Professional.php:11
A regulated professional as their register knows them: a physician, a nurse, a physiotherapist (France: the RPPS, through the Annuaire Santé); later a lawyer (the CNB's directory). Whatever the source could not tell is null or empty; $raw keeps its whole answer.
public string $identifierThe register's identifier (France: the RPPS number).
public string $familyNamepublic string $sourceWhere it came from: "annuaire-sante", "cnb".
..
public ?string $givenNamepublic ?string $prefix"M", "MME", "DR"... as the register writes it.
public ?Qualification $professionpublic array $specialtiespublic array $diplomaspublic array $workplacespublic array $phonespublic array $emailspublic array $secureEmailspublic array $languagespublic bool $activepublic ?\DateTimeImmutable $updatedAtpublic array $raw
Professional::__construct()
public function __construct(public string $identifier, public string $familyName, public string $source, public ?string $givenName = null, public ?string $prefix = null, public ?Qualification $profession = null, public array $specialties = [], public array $diplomas = [], public array $workplaces = [], public array $phones = [], public array $emails = [], public array $secureEmails = [], public array $languages = [], public bool $active = true, public ?\DateTimeImmutable $updatedAt = null, public array $raw = [])Professional::name()
public function name(): string"Arthur Saucier"
Professional::__toString()
public function __toString(): stringQualification class
final readonly class Qualification Qualification.php:10
A coded qualification as a register writes it: a profession, a specialty, a diploma, a know-how (France: the ANS's nomenclatures, TRE_G15 for the professions, TRE_R38 for the medical specialties...).
public string $codepublic string $systemThe nomenclature: a URL or a short name ("TRE_G15-ProfessionSante").
public ?string $label
Qualification::__construct()
public function __construct(public string $code, public string $system, public ?string $label = null)Qualification::__toString()
public function __toString(): stringSex enum
enum Sex Sex.php:5
case MALE = 'M'case FEMALE = 'F'case UNKNOWN = 'U'
Sex::fromAny()
public static function fromAny(mixed $value): selfFrom what registers write: "M", "F", "male", "Man", "Vrouw", "1", "2".
..
VatCheck class
final readonly class VatCheck VatCheck.php:11
What a VAT register answered about a number: valid or not, and whose. The consultation number, when the check was made with the requester's own VAT number, is the proof it was made that day - to keep with a reverse-charge invoice.
public string $numberpublic bool $validpublic \DateTimeImmutable $checkedAtpublic string $sourcepublic ?string $namepublic ?string $addresspublic ?string $consultationNumber
VatCheck::__construct()
public function __construct(public string $number, public bool $valid, public \DateTimeImmutable $checkedAt, public string $source, public ?string $name = null, public ?string $address = null, public ?string $consultationNumber = null)VatCheck::country()
public function country(): stringWorkplace class
final readonly class Workplace Workplace.php:11
Where and how a professional practises: a practice, a health centre, a hospital - its name and address, the facility's identifier when it has one (France: its FINESS), the mode of practice (self-employed, salaried) and the role held there.
public ?string $namepublic ?Address $addresspublic ?string $facilityThe facility's own identifier (France: FINESS, or the register's structure id).
public ?string $modeHow: "liberal", "salaried", or the register's own code.
public ?string $rolepublic array $phonespublic array $secureEmailspublic bool $active
Workplace::__construct()
public function __construct(public ?string $name = null, public ?Address $address = null, public ?string $facility = null, public ?string $mode = null, public ?string $role = null, public array $phones = [], public array $secureEmails = [], public bool $active = true)Workplace::__toString()
public function __toString(): stringOmnistate\Registry
CivilRegistryInterface interface
interface CivilRegistryInterface CivilRegistryInterface.php:17
A public register of acts and documents about people: a country's deaths file (France: INSEE's, through matchID), the indexes of its archives (the Netherlands and Belgium: Open Archives), an archive's catalogue. Each one says what it covers - which countries, which kinds of records, which years - so that a search screen can tell before asking.
CivilRegistryInterface::name()
public function name(): stringA short name, the CivilRecord's $source: "matchid".
CivilRegistryInterface::countries()
public function countries(): array- Returns
ISO 3166-1 alpha-2 codes of the countries whose records it holds
CivilRegistryInterface::kinds()
public function kinds(): array- Returns
the kinds of records it holds
CivilRegistryInterface::period()
public function period(): ?PeriodThe years it covers, when it has bounds (France's deaths file: since 1970); null: no bound to tell.
CivilRegistryInterface::hasImages()
public function hasImages(): boolWhether it gives the pictures of the acts (CivilRecord::$images), for some records at least.
CivilRegistryInterface::supports()
public function supports(CivilQuery $query): boolWhether the question is one for it: its country, one of its kinds, something it can search on.
CivilRegistryInterface::search()
public function search(CivilQuery $query): arrayThe records that match, the likeliest first; none is an empty list.
- Throws
Omnistate\Exception\UnavailableException the register did not answer
CivilRegistryInterface::find()
public function find(string $identifier): ?CivilRecordA record by the identifier a search gave (CivilRecord::$identifier), with everything the register tells about it; null when it does not know it.
- Throws
Omnistate\Exception\UnavailableException
CompanyRegistryInterface interface
interface CompanyRegistryInterface CompanyRegistryInterface.php:8
A register of companies: France's, the UK's Companies House.
..
CompanyRegistryInterface::name()
public function name(): stringA short name, the Company's $source: "annuaire-entreprises".
CompanyRegistryInterface::supports()
public function supports(string $identifier): boolWhether it can answer for that identifier (a SIREN, a SIRET, a company number...).
CompanyRegistryInterface::company()
public function company(string $identifier): ?CompanyThe company, with the establishment asked for among its establishments when the identifier is one; null when the register does not know it.
- Throws
Omnistate\Exception\UnavailableException the register did not answer
CompanyRegistryInterface::search()
public function search(string $query, int $limit = 10): arrayCompanies by name (or anything the register searches on).
- Throws
Omnistate\Exception\UnavailableException
FacilityRegistryInterface interface
interface FacilityRegistryInterface FacilityRegistryInterface.php:11
A register of health and social facilities (France: FINESS). A professional registry that knows them too implements both interfaces.
FacilityRegistryInterface::name()
public function name(): stringFacilityRegistryInterface::supportsFacility()
public function supportsFacility(string $identifier): boolWhether it can answer for that identifier (a FINESS number...).
FacilityRegistryInterface::facility()
public function facility(string $identifier): ?Facility- Throws
Omnistate\Exception\UnavailableException the register did not answer
InternetRegistryInterface interface
interface InternetRegistryInterface InternetRegistryInterface.php:9
The Internet's registries: domains, IP ranges, autonomous systems.
InternetRegistryInterface::name()
public function name(): stringInternetRegistryInterface::domain()
public function domain(string $name): ?Domain- Throws
Omnistate\Exception\UnavailableException
InternetRegistryInterface::network()
public function network(string $address): ?NetworkAn IP address's range, or an AS number's ("AS3215", "3215").
- Throws
Omnistate\Exception\UnavailableException
ProfessionalRegistryInterface interface
interface ProfessionalRegistryInterface ProfessionalRegistryInterface.php:12
A register of regulated professionals: France's health professionals (RPPS, through the Annuaire Santé), later its lawyers (the CNB). One contract for every profession: whoever reads it need not know which.
ProfessionalRegistryInterface::name()
public function name(): stringA short name, the Professional's $source: "annuaire-sante".
ProfessionalRegistryInterface::supports()
public function supports(string $identifier): boolWhether it can answer for that identifier (an RPPS number...).
ProfessionalRegistryInterface::professional()
public function professional(string $identifier): ?ProfessionalThe professional, null when the register does not know them.
- Throws
Omnistate\Exception\UnavailableException the register did not answer
ProfessionalRegistryInterface::search()
public function search(string $name, ?string $postcode = null, int $limit = 10): arrayProfessionals by name, those practising in that postcode only when one is given.
- Throws
Omnistate\Exception\UnavailableException
VatRegistryInterface interface
interface VatRegistryInterface VatRegistryInterface.php:8
A register of VAT numbers: the EU's VIES.
..
VatRegistryInterface::name()
public function name(): stringVatRegistryInterface::supports()
public function supports(string $number): boolWhether it answers for that (normalized) number's country.
VatRegistryInterface::check()
public function check(string $number, ?string $requester = null): VatCheck$requesteryour own VAT number: the register may then give a consultation number, the proof of the check
- Throws
Omnistate\Exception\UnavailableException the register (or the member state behind it) did not answer
- Throws
Omnistate\Exception\OmnistateException the register refused the check itself (VIES: a requester it does not accept)
Omnistate\Testing
RegistryContractTests trait
trait RegistryContractTests RegistryContractTests.php:60
What every Omnistate register does, as PHPUnit tests, offline: a provider's test case uses this trait, gives its registry (built on the HTTP client the suite hands it) and the register's recorded answers. The suite checks each of the family's contracts the registry implements (CompanyRegistryInterface, VatRegistryInterface, ProfessionalRegistryInterface, FacilityRegistryInterface, CivilRegistryInterface, InternetRegistryInterface), asked through the Omnistate facade as an application asks:
final class MatchIdContractTest extends TestCase { use RegistryContractTests;
protected function registry(HttpClientInterface $http): object { return new MatchId($http); }
protected function recordedAnswers(): array { return ['GET /deaths/search' => json_decode(file_get_contents(...), true)]; }
protected function civilQuery(): ?CivilQuery { return new CivilQuery(familyName: 'Chirac'); }
protected function civilIdentifier(): ?string { return 'fohpDS17K0Ez'; }
}It checks: - it implements at least one of the family's contracts, under a short name (its models' $source); - what it does not take (an identifier of another kind, another country's question) is a NotSupportedException from the facade, before any HTTP request; a civil register's coverage (countries, kinds, period) is well formed; - the family's rule on errors (docs/providers.md): when the register answers HTTP 401, 403, 429, 500, 503, a body that is not what it should be, or cannot be reached, every question is an UnavailableException - never null, an empty list or an invalid VAT number, which would read "unavailable" as "not found"; a 429 carries $retryAfter; - HTTP 404 on a lookup (a company, a professional, a facility, a record, a domain, a network) is null: not known; - on the recorded answers: each lookup and search gives models carrying the registry's name as $source and their identifier, a civil record of a kind the register says it holds.
No test reaches the network: every request goes to the suite's MockHttpClient, and one with no recorded answer is answered HTTP 404 and named in the failure.
Requires phpunit/phpunit and symfony/http-client (the provider's, in require-dev).
RegistryContractTests::testItImplementsTheFamilysContractsUnderItsName()
public function testItImplementsTheFamilysContractsUnderItsName(): voidRegistryContractTests::testWhatItDoesNotTakeIsNotSupportedBeforeAnyRequest()
public function testWhatItDoesNotTakeIsNotSupportedBeforeAnyRequest(): voidRegistryContractTests::testUnavailableIsNeverReadAsNotFound()
public function testUnavailableIsNeverReadAsNotFound(): voidRegistryContractTests::testNotFoundIsNull()
public function testNotFoundIsNull(): voidRegistryContractTests::testTheRecordedAnswersGiveModelsOfItsOwn()
public function testTheRecordedAnswersGiveModelsOfItsOwn(): void