Download the PHP package azaharizaman/nexus-tax without Composer

On this page you can find all versions of the php package azaharizaman/nexus-tax. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nexus-tax

Nexus\Tax

A framework-agnostic, stateless tax calculation engine with multi-jurisdiction support, temporal rate resolution, hierarchical tax structure, reverse charge mechanism, economic nexus determination, partial exemptions, place-of-supply rules for cross-border services, currency conversion for compliance reporting, and audit-ready immutable logging.

Table of Contents


Overview

The Nexus\Tax package provides a comprehensive, framework-agnostic tax calculation engine designed for global ERP systems requiring multi-jurisdiction tax compliance. It handles complex scenarios including:

Key Principle: This package is a pure calculation engine. It defines what needs to be calculated but remains stateless regarding data persistence. The consuming application layer implements repositories and handles audit log persistence.


Installation

Dependencies

This package requires the following Nexus packages:


Core Concepts

Tax Jurisdiction

A tax jurisdiction represents the geographic and administrative scope where a specific tax regime applies. Jurisdictions can be hierarchical:

The TaxJurisdictionResolverInterface determines the applicable jurisdiction based on transaction details (ship-from address, ship-to address, service classification).

Economic Nexus

Economic nexus is the legal obligation to collect and remit sales tax in a jurisdiction where the business has sufficient "economic presence," even without physical presence.

Example: A US state may require sales tax collection if annual revenue exceeds $100,000 OR transaction count exceeds 200.

The TaxNexusManagerInterface checks historical transaction data against jurisdiction-specific thresholds via the NexusThreshold Value Object.

Key Decision: Nexus determination is stateful (requires historical data analysis) and therefore belongs in the application layer implementation, not the stateless tax engine.

Place of Supply

Place of supply rules determine where a transaction is considered to occur for tax purposes. This is critical for cross-border services:

The ServiceClassification enum drives place-of-supply resolution in the TaxJurisdictionResolver.

Effective Dating & Temporal Queries

Tax rates change frequently. All tax rate lookups MUST include an effective date to ensure historical accuracy for audits and reporting.

Tax holidays (temporary rate reductions) are modeled as standard TaxRate records with 0.00% or reduced rate during the holiday period's effectiveStartDate and effectiveEndDate.

Reverse Charge Mechanism

Reverse charge (RCM) is a tax deferral mechanism for B2B cross-border transactions (common in EU VAT). Instead of the supplier charging VAT, the customer self-assesses the tax.

Critical: Reverse charge is NOT an exemption (tax still applies), it's a calculation method where:

The TaxCalculationMethod::ReverseCharge enum case triggers this logic.

Tax Holidays

Temporary tax rate reductions (e.g., back-to-school sales tax holidays). Modeled as standard TaxRate records with:

The temporal query system automatically applies the correct rate based on transaction date.

Partial Exemptions

Some entities have partial tax exemptions (e.g., 50% exempt for agricultural cooperatives). The ExemptionCertificate Value Object includes:

The calculation engine reduces the taxable base by the exemption percentage before applying tax rates:

Hierarchical Tax Structure

Compound taxes (tax-on-tax) require hierarchical calculation. The TaxBreakdown Value Object supports nested TaxLine objects:

Each TaxRate has an applicationOrder: int property. The calculator:

  1. Fetches applicable rates
  2. Sorts by applicationOrder
  3. Applies sequentially, building hierarchy

Immutable Audit Log

The Tax Audit Log is immutable. No UPDATE or DELETE operations are permitted. Adjustments require:

  1. Contra-Transaction Pattern: Create a new transaction with negative amounts
  2. New Calculation: Pass updated TaxContext to calculator
  3. Negative Result: Returns TaxBreakdown with negative amounts
  4. Persist as New Record: Application layer saves new audit log entry

This ensures complete audit trail with original calculation + correction linkage.


Architecture

Stateless Calculation Engine Pattern

Key Principles:

  1. Dependency Inversion: Package defines interfaces, application implements
  2. Statelessness: No database queries, no file I/O, pure calculation
  3. Temporal Queries: All repository methods require \DateTimeInterface
  4. Decorator Pattern: Caching, storage, notifications added by application

Folder Structure


Value Objects

All Value Objects are final readonly classes using BCMath for precision.

TaxContext

Encapsulates all inputs required for tax calculation.

TaxRate

Represents a single tax rate with temporal validity.

Key Property: applicationOrder controls calculation sequence for compound taxes.

TaxBreakdown

Hierarchical structure representing calculated tax.

TaxLine

Individual tax line within breakdown (supports nesting).

ExemptionCertificate

Tax exemption certificate metadata.

NexusThreshold

Economic nexus threshold for a jurisdiction.


Enums

All enums use native PHP 8.3 enum with business logic methods.

TaxType

TaxCalculationMethod

ServiceClassification


Interfaces

TaxCalculatorInterface

TaxRateRepositoryInterface

TaxJurisdictionResolverInterface

TaxNexusManagerInterface

TaxExemptionManagerInterface

TaxReportingInterface


Usage Examples

Basic Tax Calculation

Jurisdiction Resolution with Place of Supply

Nexus Checking

Partial Exemption Application

Reverse Charge Scenario

Multi-Currency Compliance Reporting

Tax Adjustment via Contra-Transaction

Preview Mode Pattern


Integration Patterns

Sales Package Adapter

Caching Decorator for Jurisdiction Resolver

Exemption Certificate Storage Decorator


Performance Characteristics

BCMath Precision Overhead

Tax calculations use bcmath extension for arbitrary precision arithmetic to avoid floating-point errors. This adds ~10-20% overhead vs native float operations but ensures audit-accurate calculations.

Caching Recommendations

High Cache Value:

Low Cache Value:

Recommended Indexes


Compliance Features

7-10 Year Retention

MANDATE: Tax audit logs must be retained for 7-10 years depending on jurisdiction.

Implementation: Use Nexus\Scheduler to automate archival:

EventStream Publishing Mandate

REQUIREMENT: Application layer MUST publish TaxCalculatedEvent after audit log persistence for real-time data warehouse sync.

Rate Change Monitoring

REQUIREMENT: Application layer monitors future-dated tax rates and triggers notifications.


Future Enhancements

Phase 2 Roadmap

  1. Tax Treaty Support - International withholding tax treaties (TaxTreatyManagerInterface)
  2. Tax Incentive Zones - SEZ/Free Zone reduced rates (extend TaxJurisdiction VO)
  3. Cascading Tax - Tax-on-tax for specific jurisdictions (extend calculation logic)
  4. VAT Registration Validation - VIES number checking (TaxRegistrationValidatorInterface)
  5. Split Payment Mechanism - Italy VAT split payment (extend calculation method)
  6. Real-time Rate API Integration - Avalara/TaxJar sync (TaxRateProviderInterface)
  7. Tax Exemption OCR - Certificate PDF parsing (integrate Nexus\DataProcessor)

📖 Documentation

Package Documentation

Additional Resources

License

MIT License. See LICENSE file for details.


Package Version: 1.0.0
Last Updated: November 24, 2025
Maintained By: Nexus Architecture Team


All versions of nexus-tax with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
psr/cache Version ^3.0
psr/log Version ^3.0
azaharizaman/nexus-common Version dev-main
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package azaharizaman/nexus-tax contains the following files

Loading the files please wait ...