{"action":"created","issue":{"url":"https://api.github.com/repos/moneyphp/money/issues/518","repository_url":"https://api.github.com/repos/moneyphp/money","labels_url":"https://api.github.com/repos/moneyphp/money/issues/518/labels{/name}","comments_url":"https://api.github.com/repos/moneyphp/money/issues/518/comments","events_url":"https://api.github.com/repos/moneyphp/money/issues/518/events","html_url":"https://github.com/moneyphp/money/issues/518","id":381560511,"node_id":"MDU6SXNzdWUzODE1NjA1MTE=","number":518,"title":"[Question] Best way to create a custom currency","user":{"login":"rogervila","id":6053012,"node_id":"MDQ6VXNlcjYwNTMwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/6053012?v=4","gravatar_id":"","url":"https://api.github.com/users/rogervila","html_url":"https://github.com/rogervila","followers_url":"https://api.github.com/users/rogervila/followers","following_url":"https://api.github.com/users/rogervila/following{/other_user}","gists_url":"https://api.github.com/users/rogervila/gists{/gist_id}","starred_url":"https://api.github.com/users/rogervila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogervila/subscriptions","organizations_url":"https://api.github.com/users/rogervila/orgs","repos_url":"https://api.github.com/users/rogervila/repos","events_url":"https://api.github.com/users/rogervila/events{/privacy}","received_events_url":"https://api.github.com/users/rogervila/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-16T11:28:26Z","updated_at":"2018-11-16T12:49:30Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI'm working on a ecommerce that converts 'fidelity points' to money, and I think that the best approach is to create a 'fidelity' currency that can be c[onverted through the custom fixed exchange ](http://moneyphp.org/en/stable/features/currency-conversion.html#fixed-exchange)\r\n\r\nI have checked https://github.com/moneyphp/money/issues/29 and https://github.com/moneyphp/money/pull/58, but I would like to ask what is the best way to create a custom currency.\r\n\r\nThank you.\r\n"},"comment":{"url":"https://api.github.com/repos/moneyphp/money/issues/comments/439383266","html_url":"https://github.com/moneyphp/money/issues/518#issuecomment-439383266","issue_url":"https://api.github.com/repos/moneyphp/money/issues/518","id":439383266,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTM4MzI2Ng==","user":{"login":"sagikazarmark","id":1226384,"node_id":"MDQ6VXNlcjEyMjYzODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1226384?v=4","gravatar_id":"","url":"https://api.github.com/users/sagikazarmark","html_url":"https://github.com/sagikazarmark","followers_url":"https://api.github.com/users/sagikazarmark/followers","following_url":"https://api.github.com/users/sagikazarmark/following{/other_user}","gists_url":"https://api.github.com/users/sagikazarmark/gists{/gist_id}","starred_url":"https://api.github.com/users/sagikazarmark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagikazarmark/subscriptions","organizations_url":"https://api.github.com/users/sagikazarmark/orgs","repos_url":"https://api.github.com/users/sagikazarmark/repos","events_url":"https://api.github.com/users/sagikazarmark/events{/privacy}","received_events_url":"https://api.github.com/users/sagikazarmark/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T12:49:30Z","updated_at":"2018-11-16T12:49:30Z","author_association":"MEMBER","body":"It depends on what you want to do with your currency. Creating the currency itself is easy: just give it a currency code and use it.\r\n\r\nIf you want currency conversion, then you can either implement your own Exchange class (which eg. contacts a separate service asking for conversion rate) or just use the FixedExchange with hardcoded values.\r\n\r\nFor formatting you will need to implement a MoneyFormatter. If you use other currencies as well, you can channel it into an AggregatedMoneyFormatter.\r\n\r\nLikewise, you can do the same for parsing a string representation of your currency.\r\n\r\nLast, but not least, you might want to implement your own Currencies, which is a collection of currencies. As with the exchange, you can also use an existing implementation, like CurrencyList.\r\n\r\nI suggest you checking out the Bitcoin implementations.\r\n\r\n(Note to self: we might have to write some documentation about this topic)"}}
{"actor":{"display_login":"sagikazarmark"}}