sylius/taxation
Sylius Taxation Component provides core models and extensible tax calculators to handle taxes for different items, zones, and tax rates in PHP applications. Part of the Sylius eCommerce ecosystem, designed for easy integration and customization.
sylius/taxation package aligns well with modular Laravel architectures (e.g., domain-driven design, component-based systems). Its decoupled models (e.g., TaxCategory, TaxRate, TaxCalculation) can integrate seamlessly with existing eCommerce or billing systems.Illuminate\Events). Ideal for platforms requiring dynamic tax rules (e.g., region-based, product-type-specific).symfony/options-resolver and symfony/validator, which Laravel already bundles. Minimal new dependencies.Illuminate/Cache) or session storage for dynamic contexts.TaxRateResolver.TaxCategory, TaxRate) with Laravel’s traits (e.g., HasFactory, BelongsToMany).AppServiceProvider:
$this->app->bind(TaxCalculationInterface::class, TaxCalculation::class);
TaxCalculated) for side effects (e.g., logging, notifications).tax_categories, tax_rates). Example:
Schema::create('tax_rates', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->decimal('amount', 8, 2);
$table->timestamps();
});
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class TaxRateResource extends JsonResource {
public function toArray($request) { ... }
}
composer require sylius/taxation.php artisan vendor:publish --tag=taxation-config.VatCalculator, FlatRateCalculator) extending TaxCalculation.order.created) to trigger tax calculations.event(new TaxCalculated($order, $taxTotal));
/api/tax-rates).spatie/laravel-tax). Use Composer’s replace or aliasing.tax_calculations.log).Redis) to reduce DB queries.TaxCalculationJob).tax_rates(zone_id, category_id) for faster lookups.Predis) for distributed tax rate storage.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Tax rate DB corruption | Incorrect tax calculations | Database backups + Laravel’s migrations:rollback. |
| Queue worker crashes | Delayed tax calculations |
How can I help you explore Laravel packages today?