A helper for CakePHP3 to convert numbers into words.
Have you ever wanted to use a number as a css class? Or title items in a loop, but number just look messy? I have, and so I made this quick plugin to solve that problem.
You can find the plugin listed on Packagist.
https://packagist.org/packages/davidyell/numbers_to_words
You can use this to require it into your CakePHP 3 project by adding it to your composer.json
file.
You need to load the plugin in your config/bootstrap.php
Plugin::load('NumbersToWords');
You'll need to add it to your controllers helpers array and configure your locale.
public $helpers = [
'NumbersToWords.NumbersToWords' => [
'locale' => 'en_GB'
]
];
<?= $this->NumbersToWords->spell(5); // 'five';?>
If you would like to add more conversions, please fork and submit a pull request.
See LICENSE