Peso Framework ############## :category: PHP :date: 2025-07-11 06:42:00 +0300 :tags: peso, currency conversion Another thing I've been secretly building is the `Peso Framework`_, a tool to query currency conversion rates. .. _Peso Framework: https://phpeso.org It started when I was pissed that ``florianv/exchanger``, a tool I was perfectly happy with previously, got a broken release (2.8.2) got abandoned for almost a year now, and still isn't fixed as of this post. Peso consists of 3 components: * A service (data source) * An integration (data consumer) * A glue library (``peso/core``) that contains the Service contract, standard request/response objects, and useful tools to develop services and integrations A simple example: .. code-block:: bash composer require peso/peso peso/ecb-service php-http/discovery guzzlehttp/guzzle .. code-block:: php getHistoricalExchangeRate( 'EUR', // base 'PHP', // quote '2025-06-13', // date (Y-m-d string or DateTime or arokettu/date Date) ), PHP_EOL; // '64.706' Advantages over the Exchanger: * Caching moved to the Service side making it more effective * No way for a service to mistake a historical exchange rate request with a current exchange rate request * Also currency conversion requests for services that support them * Ability to add new request types without breaking the backward compatibility * Services reside in their own separate packages so the main package is not a huge garbage dump of dead or unsupported services like Cryptonator