{"id":13828243,"url":"https://github.com/gocanto/converter","last_synced_at":"2025-04-14T22:36:08.351Z","repository":{"id":62511605,"uuid":"190698375","full_name":"gocanto/converter","owner":"gocanto","description":"Immutable PHP currency converter that's data-agnostic.","archived":false,"fork":false,"pushed_at":"2019-06-11T06:28:41.000Z","size":70,"stargazers_count":77,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-18T20:46:51.129Z","etag":null,"topics":["agnostic","converter","currencies","immutable","library","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gocanto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-07T06:31:58.000Z","updated_at":"2023-04-05T16:14:30.000Z","dependencies_parsed_at":"2022-11-02T12:46:45.426Z","dependency_job_id":null,"html_url":"https://github.com/gocanto/converter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gocanto%2Fconverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gocanto%2Fconverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gocanto%2Fconverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gocanto%2Fconverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gocanto","download_url":"https://codeload.github.com/gocanto/converter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248974646,"owners_count":21192186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agnostic","converter","currencies","immutable","library","php"],"created_at":"2024-08-04T09:02:38.115Z","updated_at":"2025-04-14T22:36:08.334Z","avatar_url":"https://github.com/gocanto.png","language":"PHP","readme":"## About it\n\n\u003ca href=\"https://packagist.org/packages/gocanto/converter\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/gocanto/converter.svg?style=flat-square\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/gocanto/converter\"\u003e\u003cimg src=\"https://img.shields.io/github/release/gocanto/converter.svg?style=flat-square\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/gocanto/converter\"\u003e\u003cimg src=\"https://img.shields.io/travis/gocanto/converter/master.svg?style=flat-square\" alt=\"Build status\"\u003e\u003c/a\u003e\n\nThe converter library is a `immutable` drop in currencies converter that's data-agnostic.. \n\nIn order for it to work, you will have to pass your repository data look up to pull in a valid information to operate on. This repository has to implement the interface `CurrenciesRepositoryInterface` [shipped](https://github.com/gocanto/converter/blob/master/src/Interfaces/CurrenciesRepositoryInterface.php) with the library  \n\n## Installation\n\nThis library uses [Composer](https://getcomposer.org) to manage its dependencies. So, before using it, make sure you have it installed in your machine. \nOnce you have done this, you will be able to pull this library in by typing the following command in your terminal.\n\n```\ncomposer require gocanto/converter\n```\n    \n## Data layer implementation\n\nFirst of all, you will have to create a repository to query either your database or any other data resources where you keep your application currencies information. [see example](https://github.com/gocanto/converter/blob/master/examples/CurrenciesRepositoryExample.php)\n\nSecond of all, you will have to new up the converter passing an instance of the mentioned interface repository implementation. Like so:\n\n```php\nuse Gocanto\\Converter\\Examples\\CurrenciesRepositoryExample;\nuse Gocanto\\Converter\\Converter;\n\n$repository = new CurrenciesRepositoryExample;\n$converter = new Converter($repository);\n```\n\u003e Note: You can bind this interface within your app service container to have automatic dependencies injection resolution.\n\nLastly, you just need to invoke the required methods within the converter object to set the proper values for a given currency conversion (currency from, currency to). Like so:\n\n```php\nuse Gocanto\\Converter\\RoundedNumber;\n\n$conversion = $converter\n    -\u003ewithAmount(RoundedNumber::make(10))\n    -\u003ewithCurrency('SGD')\n    -\u003econvertTo('USD');\n```\n\n\u003e This operation will return a Currency Conversion object that holds all the related operations info \n\n## Contributing\n\nPlease feel free to fork this package and contribute by submitting a pull request to enhance its functionalities.\n\n## License\n\nThe MIT License (MIT). Please see [License File](https://github.com/gocanto/converter/blob/master/LICENSE.md) for more information.\n\n\n## How can I thank you?\nWhy not star the github repo and share the link for this repository on Twitter?\n\n\nDon't forget to [follow me on twitter](https://twitter.com/gocanto)!\n\nThanks!\n\nGustavo Ocanto.\n\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgocanto%2Fconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgocanto%2Fconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgocanto%2Fconverter/lists"}