{"id":13545565,"url":"https://github.com/akaunting/laravel-money","last_synced_at":"2026-04-02T12:01:33.053Z","repository":{"id":40394940,"uuid":"112121508","full_name":"akaunting/laravel-money","owner":"akaunting","description":"Currency formatting and conversion package for Laravel","archived":false,"fork":false,"pushed_at":"2026-03-24T11:12:23.000Z","size":168,"stargazers_count":782,"open_issues_count":2,"forks_count":109,"subscribers_count":15,"default_branch":"master","last_synced_at":"2026-03-24T23:00:27.962Z","etag":null,"topics":["akaunting","currency","currency-converter","laravel","money","php"],"latest_commit_sha":null,"homepage":"https://akaunting.com","language":"PHP","has_issues":false,"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/akaunting.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-26T22:23:16.000Z","updated_at":"2026-03-24T11:10:55.000Z","dependencies_parsed_at":"2024-01-16T17:02:16.636Z","dependency_job_id":"e49e9196-e8c7-43c4-9fce-2f78a8c66e1c","html_url":"https://github.com/akaunting/laravel-money","commit_stats":{"total_commits":144,"total_committers":25,"mean_commits":5.76,"dds":0.5486111111111112,"last_synced_commit":"d3f8c85e60f174279fcfff6709557c44a3e745e8"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/akaunting/laravel-money","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaunting%2Flaravel-money","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaunting%2Flaravel-money/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaunting%2Flaravel-money/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaunting%2Flaravel-money/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akaunting","download_url":"https://codeload.github.com/akaunting/laravel-money/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akaunting%2Flaravel-money/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31305971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T09:48:21.550Z","status":"ssl_error","status_checked_at":"2026-04-02T09:48:19.196Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["akaunting","currency","currency-converter","laravel","money","php"],"created_at":"2024-08-01T11:01:05.819Z","updated_at":"2026-04-02T12:01:32.964Z","avatar_url":"https://github.com/akaunting.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Currency formatting and conversion package for Laravel\n\n![Downloads](https://img.shields.io/packagist/dt/akaunting/laravel-money)\n![Tests](https://img.shields.io/github/actions/workflow/status/akaunting/laravel-money/tests.yml?label=tests)\n[![StyleCI](https://github.styleci.io/repos/112121508/shield?style=flat\u0026branch=master)](https://styleci.io/repos/112121508)\n[![License](https://img.shields.io/github/license/akaunting/laravel-money)](LICENSE.md)\n\nThis package intends to provide tools for formatting and conversion of monetary values in an easy, yet powerful way for Laravel projects.\n\n### Why not use the `moneyphp` package?\n\nBecause it uses the `intl` extension for number formatting. `intl` extension isn't present by default on PHP installs and can give [different results](http://moneyphp.org/en/latest/features/formatting.html#intl-formatter) in different servers.\n\n## Getting Started\n\n### 1. Install\n\nRun the following command:\n\n```bash\ncomposer require akaunting/laravel-money\n```\n\n### 2. Publish\n\nPublish config file.\n\n```bash\nphp artisan vendor:publish --tag=money\n```\n\n### 3. Configure\n\nYou can change the currencies information of your app from `config/money.php` file\n\n## Usage\n\n```php\nuse Akaunting\\Money\\Currency;\nuse Akaunting\\Money\\Money;\n\necho Money::USD(500); // '$5.00' unconverted\necho new Money(500, new Currency('USD')); // '$5.00' unconverted\necho Money::USD(500, true); // '$500.00' converted\necho new Money(500, new Currency('USD'), true); // '$500.00' converted\n```\n\n### Advanced\n\n```php\n$m1 = Money::USD(500);\n$m2 = Money::EUR(500);\n\n$m1-\u003egetCurrency();\n$m1-\u003eisSameCurrency($m2);\n$m1-\u003ecompare($m2);\n$m1-\u003eequals($m2);\n$m1-\u003egreaterThan($m2);\n$m1-\u003egreaterThanOrEqual($m2);\n$m1-\u003elessThan($m2);\n$m1-\u003elessThanOrEqual($m2);\n$m1-\u003econvert(Currency::GBP(), 3.5);\n$m1-\u003eadd($m2);\n$m1-\u003esubtract($m2);\n$m1-\u003emultiply(2);\n$m1-\u003edivide(2);\n$m1-\u003eallocate([1, 1, 1]);\n$m1-\u003eisZero();\n$m1-\u003eisPositive();\n$m1-\u003eisNegative();\n$m1-\u003eformat();\n```\n\n### Helpers\n\n```php\nmoney(500)\nmoney(500, 'USD')\ncurrency('USD')\n```\n\n### Blade Directives\n\n```php\n@money(500)\n@money(500, 'USD')\n@currency('USD')\n```\n\n### Blade Component\n\nSame as the directive, there is also a `blade` component for you to create money and currency in your views:\n\n```html\n\u003cx-money amount=\"500\" /\u003e\nor\n\u003cx-money amount=\"500\" currency=\"USD\" /\u003e\nor\n\u003cx-money amount=\"500\" currency=\"USD\" convert /\u003e\n\n\u003cx-currency currency=\"USD\" /\u003e\n```\n\n### Macros\n\nThis package implements the Laravel `Macroable` trait, allowing macros and mixins on both `Money` and `Currency`.\n\nExample use case:\n\n```php\nuse Akaunting\\Money\\Currency;\nuse Akaunting\\Money\\Money;\n\nMoney::macro(\n    'absolute',\n    fn () =\u003e $this-\u003eisPositive() ? $this : $this-\u003emultiply(-1)\n);\n\n$money = Money::USD(1000)-\u003emultiply(-1);\n\n$absolute = $money-\u003eabsolute();\n```\n\nMacros can be called statically too:\n\n```php\nuse Akaunting\\Money\\Currency;\nuse Akaunting\\Money\\Money;\n\nMoney::macro('zero', fn (?string $currency = null) =\u003e new Money(0, new Currency($currency ?? 'GBP')));\n\n$money = Money::zero();\n```\n\n### Mixins\n\nAlong with Macros, Mixins are also supported. This allows merging another classes methods into the Money or Currency class.\n\nDefine the mixin class:\n\n```php\nuse Akaunting\\Money\\Money;\n\nclass CustomMoney\n{\n    public function absolute(): Money\n    {\n        return $this-\u003eisPositive() ? $this : $this-\u003emultiply(-1);\n    }\n\n    public static function zero(?string $currency = null): Money\n    {\n        return new Money(0, new Currency($currency ?? 'GBP'));\n    }\n}\n```\n\nRegister the mixin, by passing an instance of the class:\n\n```php\nMoney::mixin(new CustomMoney);\n```\n\nThe methods from the custom class will be available:\n\n```php\n$money = Money::USD(1000)-\u003emultiply(-1);\n$absolute = $money-\u003eabsolute();\n\n// Static methods via mixins are supported too:\n$money = Money::zero();\n```\n\n## Changelog\n\nPlease see [Releases](../../releases) for more information on what has changed recently.\n\n## Contributing\n\nPull requests are more than welcome. You must follow the PSR coding standards.\n\n## Security\n\nPlease review [our security policy](https://github.com/akaunting/laravel-money/security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Denis Duliçi](https://github.com/denisdulici)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaunting%2Flaravel-money","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakaunting%2Flaravel-money","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakaunting%2Flaravel-money/lists"}