Download the PHP package valsis/ro-company-lookup without Composer
On this page you can find all versions of the php package valsis/ro-company-lookup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ro-company-lookup
Ro Company Lookup
A production-ready Laravel package that retrieves Romanian company data by CUI from ANAF public web services. It returns clean DTOs, supports batching, caching, retries, circuit breaker, schema audit, and a very simple developer experience.
Requirements
- PHP 8.3+
- Laravel 12+
Compatibility
| PHP | Laravel | CI |
|---|---|---|
| 8.3 | 12.x | |
| 8.5 | 12.x |
Quick start
Example response:
Installation
Publish the config file (optional):
Configuration
All configuration lives in config/ro-company-lookup.php.
Core options:
driver: active driver, defaultanaftimezone: default query date timezone, defaultEurope/Bucharestlanguage: output key naming,rooren
Date formatting:
date_output_format: fallback output format for dates (defaultY-m-d)date_output_formats: per-language formats (defaultro => d.m.Y,en => Y-m-d)
HTTP + ANAF:
anaf.base_url,anaf.endpoint,anaf.timeout,anaf.connect_timeoutanaf.retries,anaf.backoff_ms,anaf.user_agent
Cache + resilience:
cache_store,cache_prefix,cache_versioncache_ttl_seconds,stale_ttl_secondsuse_locks,lock_seconds,lock_wait_secondsthrottle_seconds(optional per-CUI guard)
Observability + safety:
logging.enabled,logging.channel,logging.levelschema_audit.enabled,schema_audit.fail_on_unknown,schema_audit.snapshot_pathcircuit_breaker.enabled,circuit_breaker.failure_threshold,circuit_breaker.cooldown_seconds
Raw payloads:
enable_raw(include raw ANAF payloads inmeta.raw)
Usage
Standard lookup
The lookup accepts RO123, ro 123, or 123 and normalizes to an integer CUI. By default, the query date is "today" in Europe/Bucharest.
ANAF mapping is strict to the v9 payload fields (date_generale, inregistrare_scop_Tva, adresa_domiciliu_fiscal, adresa_sediu_social, etc.). Legacy/alternate key names are intentionally not mapped.
Non-throwing API
Summary helpers (simplest UX)
Batch helpers
Validation / normalization
After normalization, the CUI must be between 2 and 10 digits. Invalid input returns standardized error codes such as invalid_cui, invalid_cui_too_short, or invalid_cui_too_long.
Date formatting (global + per request)
Global (config):
Per request override:
DTO structure (high level)
The main response is CompanySimpleData:
company(CUI, names, trade register, profile)caen(primary CAEN)address(fiscal + registered office)contact(phones, emails)legal(current + history)vat(current + history)vat_collection(TVA la incasare)inactive_status(inactiv/reactivat)split_vatmeta(source, query date, cache status, raw)
Company profile (company.profile) includes:
registration_dateregistration_statusfiscal_officeownership_forme_invoice_statuse_invoice_registration_dateiban
Output examples
Summary response
exists is true only when status is ok. valid indicates whether the CUI input passed validation.
Full response (excerpt, RO)
Caching, retries, and resilience
- Results are cached by driver + CUI + date.
- Default cache TTL is 24 hours.
- When a request fails and a stale cache entry exists (within the configured stale TTL), the stale entry is returned with
meta.is_stale = true. - Bump
cache_versionto invalidate cache after mapping changes. - Retries use exponential backoff and only trigger on 429 and 5xx responses.
- Circuit breaker (optional) opens after repeated 5xx responses and cools down for a configurable interval.
- Optional
throttle_secondsguards rapid repeated queries per CUI.
Errors
The package throws typed exceptions for error scenarios:
InvalidCuiExceptionfor invalid inputLookupFailedExceptionfor upstream failuresCircuitOpenExceptionwhen the circuit is open
For user-facing flows, prefer tryLookup() / trySummary() helpers.
Artisan commands
Example output (ro-company-lookup:check, fictive data):
Example output (ro-company-lookup:demo, fictive data):
Schema audit
Enable unknown-key detection and optional snapshots:
Documentation
- Full docs:
docs/wiki/Home.md - JSON Schemas:
docs/schemas
Testing
Changelog
See CHANGELOG.md.
Contributing
See CONTRIBUTING.md. Dependabot is enabled.
Code of Conduct
See CODE_OF_CONDUCT.md.
Security
See SECURITY.md.
License
The MIT License (MIT). See LICENSE.
All versions of ro-company-lookup with dependencies
illuminate/cache Version ^12.0
illuminate/http Version ^12.0
illuminate/support Version ^12.0
spatie/laravel-data Version ^4.0
spatie/laravel-package-tools Version ^1.16