New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

bambamboole/tools

Tools: tax rates, VAT id validation and more.
3,155
Install
composer require bambamboole/tools
Latest Version:0.1.0
PHP:^8.4
Laravel:12 · 13
License:MIT
Last Updated:Aug 8, 2026
Links: GitHub  ·  Packagist
Maintainer: bambamboole

bambamboole/tools

A small toolbox for European commerce plumbing:

All amounts and rates are Brick\Math\BigDecimal — no floats.

Requirements

  • PHP 8.4+ with ext-soap and ext-dom

Installation

composer require bambamboole/tools

Usage

use Bambamboole\Tools\ToolManager;

$tools = new ToolManager();

// VAT rates for a country (TEDB)
$rates = $tools->taxRates()->getTaxRates('DE');

// Validate a VAT id (VIES)
$result = $tools->vatId()->validate('DE123456789');
$result->valid; // bool

// ECB euro reference rates, latest or historical
$day = $tools->exchangeRates()->getExchangeRates();
$day->rate('USD'); // BigDecimal

$day = $tools->exchangeRates()->getExchangeRates(new DateTimeImmutable('2020-03-13'));

// Convert money, incl. cross rates via EUR
use Brick\Math\RoundingMode;
use Brick\Money\Money;

$converter = $tools->currencyConverter();
$converter->convert(Money::of(100, 'USD'), 'GBP', roundingMode: RoundingMode::HalfEven);

Caching

The tax rate and exchange rate clients accept any Illuminate\Contracts\Cache\Repository (usable standalone, no Laravel app required). Fetched feeds are cached in bulk, historical days indefinitely, today's rates for 15 minutes. When the cache store supports atomic locks (Redis, Valkey, memcached, database), concurrent misses are collapsed into a single fetch.

use Illuminate\Cache\ArrayStore;
use Illuminate\Cache\Repository;

$cache = new Repository(new ArrayStore());
$rates = $tools->exchangeRates($cache)->getExchangeRates();

Laravel

The service provider is auto-discovered and wires everything against your default cache store — inject and go:

public function __construct(
    private readonly Bambamboole\Tools\ExchangeRates\ExchangeRatesClient $exchangeRates,
    private readonly Brick\Money\CurrencyConverter $converter,
) {}

Or use the auto-discovered Tools facade:

use Tools;

Tools::taxRates()->getTaxRates('DE');
Tools::vatId()->validate('DE123456789');
Tools::exchangeRates()->getExchangeRates();
Tools::currencyConverter()->convert(...);

Testing

composer test

License

MIT

Related Packages

bambamboole/laravel-lokalise

A laravel package to effortlessly sync translations with Lokalise

32,429 3
bambamboole/laravel-openapi

A laravel package which provides a smooth OAS workflow

13,893 1
mannysoft/laravel-vatlayer

Laravel package for VAT Layer

406 1
the-tool/the-tool

The Tool is an independent micro-service tools collection.

1 1
bambamboole/laravel-translation-dumper

A laravel package to dump missing translation keys into the translation files

52,312 10

Version History

Version Released PHP Laravel License
0.1.0 ^8.4 ^12.0|^13.0 MIT