Search by

kumwe / conversion-extension

llewellyn

Typed money-rate and unit-conversion provider contribution definitions.

Package info

github.com/kumwe/conversion-extension

pkg:composer/kumwe/conversion-extension

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.4 2026-09-08 17:33 UTC

README

kumwe/conversion-extension supplies two immutable contribution definitions under Kumwe\Conversion\Contribution: MoneyRateProviderDefinition and UnitConversionProviderDefinition. They connect Contribution declarations to canonical Conversion requests.

PHP 8.5, kumwe/contribution 0.1.1, and kumwe/conversion 0.1.5 are the required dependency coordinates. The shared package gate installs these released versions and verifies a fresh archive consumer. A human merge triggers the same checks on the resulting default-branch commit and publishes the recorded version.

use Kumwe\Conversion\Contribution\MoneyRateProviderDefinition;
use Kumwe\Conversion\Contribution\UnitConversionProviderDefinition;

$rates = new MoneyRateProviderDefinition('acme.rates.ecb', ['USD', 'EUR'], 3);
$units = new UnitConversionProviderDefinition('acme.units.trade', ['case', 'unit']);
$manifest = $rates->toArray();
$restored = MoneyRateProviderDefinition::fromArray($manifest);

Provider claims contain 1–64 entries, are deduplicated and sorted, and use priorities from -128 through 127. prices(MoneyConversionRequest) and relates(UnitConversionRequest) return true only when both ends belong to the closed claim. These predicates do not invoke providers or convert values. Currency validation checks three uppercase ASCII letters; it does not consult an ISO currency catalogue. Unit spelling is owned by Conversion.

From a source checkout with installed dependencies, run php examples/consumer.php to exercise both predicates using actual typed Conversion requests. From a Composer consumer root, run php vendor/kumwe/conversion-extension/examples/consumer.php vendor/autoload.php. The optional first argument selects that consumer’s real Composer autoload file; an unavailable explicit path is refused. See public API, architecture, integration, verification, and the migration handoff.

The former MoneyRateProviderRegistrar and UnitConversionProviderRegistrar classes are withdrawn in the current App/SDK contract. Providers are declared in signed contributions.integration.rate_providers and contributions.integration.unit_converters manifests, then bound by identifier through Kumwe\Extension\Spi\Binding\ExtensionBindingRegistrar::moneyRateProvider() and ::unitConversionProvider(). Conversion owns the corresponding Provider interfaces; App owns trusted-generation admission and executable storage. Do not recreate the withdrawn registrars. This package has no registrar, ConfigProvider, factories, rate tables, conversion algorithms, native extension, PHP fallback, or service locator. “Extension” means a business contribution, not a Zend or PIE extension.

After installing dependencies, run composer check. The isolated archive consumer supports explicit local dependency sources for preliminary evidence; App adoption remains a separate integration task after published artifact verification.