amondi-media/laravel-evatr
Laravel package to validate German and EU VAT IDs via the official German Federal Central Tax Office (eVatR) online service. Provides a validation rule and rule extension, configurable requester VAT ID, API URL, and timeout.
guzzlehttp/guzzle (Laravel’s default HTTP client) and PHP ≥8.1.publishes trait..env) for sensitive data (e.g., API keys if needed).| Risk Area | Severity | Mitigation |
|---|---|---|
| BZSt API Unavailability | High | Implement circuit breakers (e.g., spatie/fractal) and fallback to local validation. |
| Rate Limiting | Medium | Cache responses (e.g., laravel-cache) and batch requests. |
| SOAP vs. REST | High | Confirm API protocol; SOAP may require php-soap extension. |
| GPL-3.0 License | Medium | Ensure compliance if integrating into proprietary software (e.g., open-source only). |
| No Tests/Documentation | Medium | Write integration tests for edge cases (e.g., invalid VAT numbers, network errors). |
Cache::remember() for API responses.Http and Mockery to test API interactions.DE123456789).composer require amondi-media/laravel-evatr
php artisan vendor:publish --provider="AmondiMedia\Evatr\EvatrServiceProvider"
.env (e.g., EVATR_API_TIMEOUT=30).use AmondiMedia\Evatr\Facades\Evatr;
public function validateVat(Request $request) {
$valid = Evatr::validate($request->vat_number);
// ...
}
store routes).$this->mock(GuzzleHttp\HandlerStack::class, function ($mock) {
$mock->shouldReceive('__invoke')->andReturn(...);
});
composer.json).laravel/framework constraint).Monolog).dd() or dump() for debugging validation results.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| BZSt API Downtime | No VAT validation | Fallback to local regex validation (e.g., EU VAT regex). |
| Rate Limit Exceeded | Throttled requests | Implement exponential backoff + caching. |
| Invalid VAT Format (e.g., "ABC123") | False positives/negatives | Combine API + regex validation; log edge cases. |
| Network Timeouts | Slow responses | Increase timeout (configurable) + retry logic. |
| Package Abandonment (0 stars) | No updates | Fork the repo or rewrite critical components. |
DE123456789, FR: FR12345678901).How can I help you explore Laravel packages today?