Giter Site home page Giter Site logo

rmunate / spellnumber Goto Github PK

View Code? Open in Web Editor NEW
288.0 288.0 43.0 5.91 MB

🔢 Convert Numbers to Words Effortlessly in Laravel! 🌟🔠 Say goodbye to complex coding! This ingenious library, seamlessly integrated with the native PHP INTL extension, empowers you to effortlessly transform numbers into words within your Laravel projects. 🚀📊

Home Page: https://rmunate.github.io/SpellNumber/

PHP 100.00%
laravel-framework library php

spellnumber's Introduction

Hello, 👋 I'm Raul Mauricio Uñate.

🚀 Full Stack Software Developer | Open Source Contributor | Crafting High-Performance Solutions

Skills

Laravel PHP Python wxPython tkinter Flask VBScript JavaScript Vue.js React.js React Native Angular Ionic AutoIt Selenium VB.net C# Oracle PL/SQL SQLServer PostgreSQL MySQL SQLite MariaDB ISS Server Linux Server Azure DevOps Jira Google Cloud Platform

GitHub Stats

Contributions

GitHub Stats

Top Languages

Contact

📧 Email: [email protected]

Thanks for visiting my profile! I'm passionate about crafting open-source solutions and contributing to developer empowerment worldwide.

Feel free to explore my repositories and collaborate on them. Let's create amazing solutions together! 🎉

Become a Sponsor

spellnumber's People

Contributors

alejandrodiazpinilla avatar ashokdevatwal avatar datlechin avatar gdsrmygdsrjr avatar jetwes avatar olsza avatar rmunate avatar sirosfakhri avatar stylecibot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spellnumber's Issues

Cannot cache configs due to callback present in config file

   /*
    |--------------------------------------------------------------------------
    | Encountered a specific adjustment in the number to words output?.
    |--------------------------------------------------------------------------
    |
    | Here, you have the option to adjust whatever you need, the best part!
    | This adjustment will apply to all your number to words outputs.
    |
    */

    'callback_output' => function ($data) {
        // Your logic here...

        return $data->getWords();
    },

This block of code in the config files prevents caching config file. See output below:

INFO  Caching the framework bootstrap files.                              
                                                                               
    config ........................................................... 36ms F  
  AIL                                                                          
                                                                               
     LogicException                                                            
                                                                               
    Your configuration files are not serializable. 

Natural language support

Would be great to have commas and words like 'and' in the spelling of numbers as perhaps an optional parameter, for example 'two thousand, three hundred and five' I guess this could be achieved by identifying the keywords that trigger a comma and word counting in php to add the 'and'.

Add Lang: Alemania: alemán

Taking into account the great use of the Framework in this language, the collaboration of a collaborator with this native language is sought to adjust and add support to this language.

Cambiar formato de texto para los centavos.

Que tal, existe alguna manera que en vez de decir los centavos con la palabra "con" se pueda configurar para que diga "punto"? Pero solo en ciertos casos, no para todos, en los pesos funciona con la palabra "con" pero en numeros solos, es mejor con "punto".

Ejemplo:
21,981.24
veintiún mil novecientos ochentaiún con veinticuatro centavos.

Que saliera el output:
21,981.24
veintiún mil novecientos ochentaiún punto veinticuatro centavos

Locale is ignored

Hello,
I have a really strange problem.
I published config and update locale to it.
In local and testing environment everything is fine.
Running unit test of my application in GitLab pipelines, it seems that locale switch back to en, according to output, even if dumping $data in callback_output shows that locale is set to it:

Rmunate\Utilities\Callback\DataResponse Object
(
    [method:protected] => toLetters
    [type:protected] => integer
    [lang:protected] => it
    [locale:protected] => it
    [mode:protected] => 
    [currency:protected] => 
    [fraction:protected] => 
    [value] => 118
    [words] => one hundred eighteen
)

As you can see, lang and locale are set to it, number is 118 but words are in English.

This instead is my local output:

Rmunate\Utilities\Callback\DataResponse Object
(
    [method:protected] => toLetters
    [type:protected] => integer
    [lang:protected] => it
    [locale:protected] => it
    [mode:protected] =>
    [currency:protected] =>
    [fraction:protected] =>
    [value] => 118
    [words] => centodiciotto
)

Any hint? Thank you.

Review German

@jetwes I hope you are well, I require your support to validate if the German language is correctly configured, I have received the following comment:

SpellNumber::value(1000000.99)
    ->locale('de')
    ->currency('Euro')
    ->fraction('Cent')
    ->toMoney();

// Eine Million Von Euro Und Neunundneunzig Cent
As a german I can assure you there are some things wrong with this:

The replacement makes no sense. "Eine Million Von Euro" is grammatically incorrect and it should simply be "Eine Million Euro." Even if the "von" was correct it would have to be written in lowercase.
Capitalization is wrong. I found a Str::title(...) in the code that just capitalizes every word. This makes it easy but results in a wrong output as well. The "Eine" for example is correctly capitalized in case the output is at the beginning of a sentence but should be lowercased when it's not ("Eine Million [...] fehlen noch" but "Ich habe eine Million [...]"). Spellouts up to a million (but not including) are generally lowercased, so the output should/could be "Eine Million Euro und neunundneunzig Cent" (the "und" and "neunundneunzig" are lowercased).

Origin:
@dennisprudlo
https://github.com/dennisprudlo

Support for Laravel 11

composer
rmunate/spell-number[v4.0.0, ..., v4.2.2] require illuminate/support ^8.0|^9.0|^10.0

Laravel 11th is out. Looking forward to the update.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.