{"id":20170788,"url":"https://github.com/pear/numbers_words","last_synced_at":"2025-04-05T00:07:43.063Z","repository":{"id":1960145,"uuid":"2890630","full_name":"pear/Numbers_Words","owner":"pear","description":"The PEAR Numbers_Words package provides methods for spelling numerals in words.","archived":false,"fork":false,"pushed_at":"2023-02-27T17:50:12.000Z","size":483,"stargazers_count":75,"open_issues_count":8,"forks_count":57,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-05-15T17:49:14.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pear.php.net/package/Numbers_Words","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pear.png","metadata":{"files":{"readme":"README","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-12-01T11:31:35.000Z","updated_at":"2023-09-23T09:42:59.000Z","dependencies_parsed_at":"2023-07-05T17:15:26.138Z","dependency_job_id":null,"html_url":"https://github.com/pear/Numbers_Words","commit_stats":{"total_commits":219,"total_committers":33,"mean_commits":6.636363636363637,"dds":0.7625570776255708,"last_synced_commit":"0a0975986631d13cfb66ecc583c1c2eec4f005f0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNumbers_Words","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNumbers_Words/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNumbers_Words/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pear%2FNumbers_Words/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pear","download_url":"https://codeload.github.com/pear/Numbers_Words/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"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":[],"created_at":"2024-11-14T01:21:06.514Z","updated_at":"2025-04-05T00:07:43.045Z","avatar_url":"https://github.com/pear.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"** Introduction:\n\nWith PEAR::Numbers_Words class you can change an integer number\nto simple words. This can be usefull when you need to spell a currency\nvalue e.g. on an invoice.\n\nYou can choose between several languages (language files are located\nin Numbers/Words/ directory).\n\nBTW: if you need to change number to currency, use money_format()\nPHP function (available since 4.3 (not yet released)). But you must\nknow that locale LC_MONETARY rules are sometimes unclear.\n\n** Getting started:\n\nFirst you need to install Numbers_Words PEAR package.\nYou can do it (as root) with:\n\n  pear install Numbers_Words\n\nIn your php script you need to load Numbers/Words.php header file:\n\n  require_once('Numbers/Words.php');\n\nThen you can call Numbers_Words::toWords() function with two\narguments: integer number (can be a string with digits) and\noptional locale name (default is en_US):\n\n$ret = Numbers_Words::toWords($num,\"en_GB\");\nif (PEAR::isError($ret)) {\n    echo \"Error: \" . $ret-\u003emessage . \"\\n\";\n  } else {\n    echo \"Num $num in British English is '\u003cb\u003e$ret\u003c/b\u003e'\u003cp\u003e\\n\";\n}\n\nFor  this would display:\n\nNum 12340000000 in British English is '\u003cb\u003etwelve thousand million three hundred forty million\u003c/b\u003e'\u003cp\u003e\n\n** Current State:\n\nThe current release can be found at the PEAR webpage:\n  http://pear.php.net/package-info.php?package=Numbers_Words\n\nFor the time of writting this Readme file, Numbers_spell package has the\nstatus beta, which means there can be samo bugs, and it is under development.\nThis is not mature code.\n\n** Development\n\nThis package needs help from people, who can write language modules other\nthan Polish and English.\n\n** Package Content:\n\n  Readme.txt - this file\n  ChangeLog  - change log\n  test-numbers-words.php  - test file showing Numbers_Words example usage\n  Words.php  - main class file, that loads language modules on demand\n  Words/lang.{LOCALE_NAME}.php - language modules\n\nThere are avaibale the following modules (called by locale name,\nin alphabetical order):\n\n  az     - Azerbaijani language.\n           Author: Shahriyar Imanov\n\n  bg     - Bulgarian language (in WIN-1251 charset).\n           Author: Kouber Saparev\n\n  cs     - Czech language.\n           Author: Petr 'PePa' Pavel\n\n  de     - German language.\n           Author: Piotr Klaban\n\n  dk     - Danish language.\n           Author: Jesper Veggerby\n\n  en_100 - Donald Knuth number naming system, in English language.\n           Author: Piotr Klaban\n\n  en_GB  - British English notation of numbers, where\n           one billion is 1000000 times one million.\n           1000 times million is just 'thousand million' here.\n           I do not use a word billiard here, because\n           English people do not use it often, and even could not know it.\n           Author: Piotr Klaban\n\n  en_US  - American English notation of numbers, where\n           one billion is 1000 times one million\n           Author: Piotr Klaban\n\n  es     - Spanish (Castellano) language.\n           Author: Xavier Noguer\n\n  es_AR  - Argentinian Spanish language.\n           Author: Martin Marrese\n\n  et     - Estonian language.\n           Author: Erkki Saarniit\n\n  fr     - French language.\n           Author: Kouber Saparev\n\n  fr_BE  - French (Belgium) language.\n           Author: Kouber Saparev, Philippe Bajoit\n\n  he     - Hebrew language.\n           Author: Hadar Porat\n\n  hu_HU  - Hungarian language.\n           Author: Nils Homp\n\n  id     - Indonesia language.\n           Authors: Ernas M. Jamil, Arif Rifai Dwiyanto\n\n  it_IT  - Italian language.\n           Authors: Filippo Beltramini, Davide Caironi\n\n  lt     - Lithuanian language.\n           Author: Laurynas Butkus\n\n  nl     - Dutch language.\n           Author: WHAM van Dinter\n\n  pl     - Polish language (in an internet standard charset ISO-8859-2)\n           Author: Piotr Klaban\n\n  pt_BR  - Brazilian Portuguese language.\n           Authors: Marcelo Subtil Marcal, Mario H.C.T., Igor Feghali\n\n  ro_RO  - Romanian language.\n           Author: Bogdan Stancescu\t\n\n  ru     - Russian language.\n           Author: Andrey Demenev\n\n  sv     - Swedish language.\n           Author: Robin Ericsson\n\n  tr_TR  - Turkish language.\n           Author: Shahriyar Imanov\n\n** What if numbers have fraction part?\n\nYou can split the number by the coma or dot. The example\nfunction was provided by Ernas M. Jamil (see below).\nI do not know if the splitting and concatenating numbers\nshould be supported by Numbers_Words ... Does each language\nspell numbers with a 'coma'/'koma'? What do you think?\n\nfunction num2word($num, $fract = 0) {\n        require_once('Numbers/Words.php');\n\n        $num = sprintf(\"%.\".$fract.\"f\", $num);\n        $fnum = explode('.', $num);\n\n        $ret =  Numbers_Words::toWords($fnum[0],\"id\");\n        if(!$fract) return $ret;\n\n        $ret .=  ' koma '; // point in english\n        $ret .= Numbers_Words::toWords($fnum[1],\"id\");\n\n        return $ret;\n}\n\n** How to convert decimal part and not fraction part of the currency value?\n\nRob King send me a patch that would allow to leave fraction part in digits.\nI.e. you can convert 31.01 into 'thirty-one pounds 01 pence':\n\n  require_once('Numbers/Words.php');\n  require_once('Numbers/Words/lang.en_GB.php');\n\n  $obj = new Numbers_Words_en_GB;\n  $convert_fraction = false;\n  print $obj-\u003etoCurrencyWords('GBP', '31', '01', $convert_fraction) . \"\\n\";\n\n** How to write new Language Files:\n\nJust copy existing en_US or en_GB etc. file into lang.{your_country/locale code}.php\nand translate digits, numbers, tousands to your language. Then please send it\nto the author to the address makler@man.torun.pl.\n\n** Credits\n\nAll changes from other people are desrcribed with details in ChangeLog.\nThere are also names of the people who send me patches etc.\nAuthors of the language files are mentioned in the language files directly\nas the author.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpear%2Fnumbers_words","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpear%2Fnumbers_words","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpear%2Fnumbers_words/lists"}