Monday, September 18, 2023
HomePHPTransform Numbers to Words in Laravel with SpellNumber

Transform Numbers to Words in Laravel with SpellNumber


SpellNumber is an awesome little plan to transform words in Laravel conveniently utilizing the PHP INTL expansion to take care of the conversions effortlessly:

usage RmunateUtilitiesSpellNumber;

SpellNumber:: worth( 100)->> toLetters();

// "One Hundred"

SpellNumber:: worth( 12300000)->> toLetters();

// "Twelve Million 3 Hundred Thousand"

At the time of creating, it sustains 6 locations, so you can transform numbers to numerous languages:

SpellNumber:: worth( 100)->> location(' en')->> toLetters();

// "One Hundred"

SpellNumber:: worth( 100)->> location(' es')->> toLetters();

// "Cien"

It likewise deals with money or drifting factor numbers:

SpellNumber:: worth( 100)->> location(' en')->> money(' bucks')->> toMoney();

SpellNumber:: worth( 100.12)

->> location(' en')

->> money(' Bucks')

->> portion(' cents')

->> toMoney();

// "One Hundred Dollars As Well As Twelve Cents"

You can find out more concerning this plan, obtain complete setup directions, and also see the resource code on GitHub.

RELATED ARTICLES

Most Popular

Recent Comments