{"id":28429,"date":"2018-03-12T11:16:28","date_gmt":"2018-03-12T09:16:28","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28429"},"modified":"2018-03-12T11:17:37","modified_gmt":"2018-03-12T09:17:37","slug":"money-php-library-to-make-working-with-money-safer-easier-and-fun","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2018\/03\/12\/money-php-library-to-make-working-with-money-safer-easier-and-fun\/","title":{"rendered":"money &#8211; PHP library to make working with money safer, easier, and fun"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p><a href=\"https:\/\/github.com\/moneyphp\/money\">money<\/a> is a PHP library that implements <a href=\"https:\/\/martinfowler.com\/eaaCatalog\/money.html\">Martin Fowler&#8217;s design pattern<\/a> for money.\u00a0 See <a href=\"http:\/\/moneyphp.org\/en\/latest\/\">the official documentation<\/a> and <a href=\"http:\/\/verraes.net\/2011\/04\/fowler-money-pattern-in-php\/\">this blog post<\/a> for more information.<\/p>\n<p>Some of the issues addresses by this library are the binding of the money amount to the currency, and currency conversion operations.\u00a0 If your code needs to deal with multiple currencies, you&#8217;ll definitely benefit from this library.\u00a0 But even if you are dealing with a single currency, it&#8217;s still pretty handy, making the code more transparent and future proof.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>money is a PHP library that implements Martin Fowler&#8217;s design pattern for money.\u00a0 See the official documentation and this blog post for more information. Some of the issues addresses by this library are the binding of the money amount to the currency, and currency conversion operations.\u00a0 If your code needs to deal with multiple currencies, &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2018\/03\/12\/money-php-library-to-make-working-with-money-safer-easier-and-fun\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">money &#8211; PHP library to make working with money safer, easier, and fun<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"money - PHP library to make working with money safer, easier, and fun #WebDev #PHP #DesignPatterns #BestPractices #money #currencies","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[3069,3244,3136,3566,123,38,1330],"keyring_services":[],"class_list":["post-28429","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-best-practices","tag-currency","tag-design-patterns","tag-martin-fowler","tag-money","tag-php","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":29183,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/01\/06\/swap-currency-exchange-rates-library\/","url_meta":{"origin":28429,"position":0},"title":"Swap &#8211; currency exchange rates library","author":"Leonid Mamchenkov","date":"January 6, 2019","format":false,"excerpt":"Swap is a currency exchange rates library for PHP. It provides a single interface to conveniently work with currency exchange rates and integrates with more than a dozen of different exchange rates providers.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":29041,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/11\/30\/php-countries-and-currencies\/","url_meta":{"origin":28429,"position":1},"title":"PHP: Countries and currencies","author":"Leonid Mamchenkov","date":"November 30, 2018","format":false,"excerpt":"Many software projects deal with the lists of countries and currencies.\u00a0 Some of the most common tasks include country an currency dropdowns, country flags next to the IP, or pre-filling country codes in phone numbers. All of that information is of course standardized and you often just need a library\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":12148,"url":"https:\/\/mamchenkov.net\/wordpress\/2010\/02\/17\/cakephp-building-factories-with-models-and-behaviors\/","url_meta":{"origin":28429,"position":2},"title":"CakePHP : Building factories with models and behaviors","author":"Leonid Mamchenkov","date":"February 17, 2010","format":false,"excerpt":"CakePHP is a wonderful framework. \u00a0 Recently I proved it to myself once again (not that I need much of that proof anyway). \u00a0The problem that we had at work was a whole lot of code in once place and no obvious way of how to break that code into\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28847,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/09\/php-safe-and-rector\/","url_meta":{"origin":28429,"position":3},"title":"PHP Safe and Rector","author":"Leonid Mamchenkov","date":"October 9, 2018","format":false,"excerpt":"I came across a couple of very interesting PHP libraries today. The first one is\u00a0thecodingmachine\/safe.\u00a0 This library wraps all PHP functions that return false on failure into another function that throws the exception instead. Think of all those file_get_contents() and json_decode() situations you had to code around.\u00a0 Not anymore.\u00a0 You\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":17302,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/12\/11\/spl-standard-php-library\/","url_meta":{"origin":28429,"position":4},"title":"SPL &#8211; Standard PHP Library","author":"Leonid Mamchenkov","date":"December 11, 2012","format":false,"excerpt":"I've been looking at SPL for some time now. \u00a0On one hand, it's a new addition to PHP core (since version 5.3), so I know how to work without it. \u00a0On the other hand, it provides standardized solutions for common problems, and that should be enough reason to start using\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27684,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/06\/14\/formapropvm-php-library-for-building-workflows-and-business-processes\/","url_meta":{"origin":28429,"position":5},"title":"formapro\/pvm &#8211; PHP library for building workflows and business processes","author":"Leonid Mamchenkov","date":"June 14, 2017","format":false,"excerpt":"formapro\/pvm is a PHP library for building workflows and business processes. \u00a0This is a nice addition to alternatives that I've looked at in \"Getting started with workflows in PHP\". \u00a0The library is brought to you by Forma Pro, the same guys who are behind the php-enqueue enterprise queuing solution in\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/06\/pizza-process-500x211.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28429","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28429"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28429\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28429"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28429"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28429"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28429"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}