{"id":20433960,"url":"https://github.com/cable8mm/n-format","last_synced_at":"2025-04-12T21:11:22.983Z","repository":{"id":62498885,"uuid":"272403982","full_name":"cable8mm/n-format","owner":"cable8mm","description":"Small NumberFormatter Extension Library","archived":false,"fork":false,"pushed_at":"2025-02-25T09:27:43.000Z","size":121,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T15:21:16.477Z","etag":null,"topics":["currency","formatter","locale","number","php"],"latest_commit_sha":null,"homepage":"https://www.palgle.com/n-format/","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/cable8mm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-15T10:03:44.000Z","updated_at":"2025-02-25T09:27:47.000Z","dependencies_parsed_at":"2022-11-02T11:46:48.492Z","dependency_job_id":"f6006567-6153-4c95-8b2b-8f1dcdca3282","html_url":"https://github.com/cable8mm/n-format","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2Fn-format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2Fn-format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2Fn-format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cable8mm%2Fn-format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cable8mm","download_url":"https://codeload.github.com/cable8mm/n-format/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631676,"owners_count":21136562,"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":["currency","formatter","locale","number","php"],"created_at":"2024-11-15T08:22:58.296Z","updated_at":"2025-04-12T21:11:22.974Z","avatar_url":"https://github.com/cable8mm.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N-Format\n\n[![code-style](https://github.com/cable8mm/n-format/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/n-format/actions/workflows/code-style.yml)\n[![run-tests](https://github.com/cable8mm/n-format/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/n-format/actions/workflows/run-tests.yml)\n![Packagist Version](https://img.shields.io/packagist/v/cable8mm/n-format)\n![Packagist Downloads](https://img.shields.io/packagist/dt/cable8mm/n-format)\n![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/cable8mm/n-format/php)\n![Packagist Stars](https://img.shields.io/packagist/stars/cable8mm/n-format)\n![Packagist License](https://img.shields.io/packagist/l/cable8mm/n-format)\n\nPHP already includes NumberFormat classes and functions, but they may not be available for some countries like Korea and Japan. Therefore, we provide a small wrapper library to extend NumberFormat, similar to how Carbon extends DateTime. Additionally, some additional functions have been provided.\n\nIf you have used Laravel, you could use `NFormatHelper` helper class. Refer to the [Usage Laravel Helper](#laravel-helper) section.\n\nWe have provided the API Documentation on the web. For more information, please visit \u003chttps://www.palgle.com/n-format/\u003e ❤️\n\n## Install\n\n```sh\ncomposer require cable8mm/n-format\n```\n\n## Usage\n\nGeneral:\n\n```php\nprint NFormat::currency(358762);\n// default locale = 'ko_KR' currency = 'KRW'\n//=\u003e ₩358,762\n```\n\n```php\nprint NFormat::spellOut(5);\n// default locale = 'ko_KR' currency = 'KRW'\n//=\u003e 오\n```\n\n```php\nNFormat::$locale = 'ja_JP';\n\nprint NFormat::spellOut(5);\n//=\u003e 五\n\n```\n\n```php\nprint NFormat::decimal(12346);\n//=\u003e 12,346\n\nprint NFormat::percent(12346);\n//=\u003e 1,234,600%\n\nprint NFormat::rawPercent(12346);\n//=\u003e 12,346%\n\n```\n\nNew special method `ordinalSpellOut` and `currencySpellOut`(only ko_KR):\n\n```php\nprint NFormat::ordinalSpellOut(10);\n//=\u003e 열번째\n\nprint NFormat::currencySpellOut(12346);\n//=\u003e 12,346 원\n```\n\nYou can also use `price()` and `smartPrice()` to calculate the price for customers.\n\n```php\nprint NFormat::price(12346, -2);\n//=\u003e 12300\n\nprint NFormat::price(12346.23, 1);\n//=\u003e 12346.20\n\nprint NFormat::smartPrice(12346);\n//=\u003e 12300\n\nprint NFormat::smartPrice(123467);\n//=\u003e 123000\n\nprint NFormat::smartPrice(1234678);\n//=\u003e 1230000\n\nprint NFormat::smartPrice(12346432);\n//=\u003e 12350000\n\nprint NFormat::smartPrice(3212343232);\n//=\u003e 3212340000\n```\n\n### Laravel Helper\n\nYou can utilize this in Laravel Blade without any need for installation:\n\n```blade\n{{ NFormatHelper::currency(12346) }}\n```\n\n## Formatting\n\n```sh\ncomposer lint\n# Modify all files to comply with the PSR-12.\n\ncomposer inspect\n# Inspect all files to ensure compliance with PSR-12.\n```\n\n## Test\n\n```sh\ncomposer test\n```\n\n## License\n\nThe N-Format is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcable8mm%2Fn-format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcable8mm%2Fn-format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcable8mm%2Fn-format/lists"}