- How do I install henriquemattia/moeda-br in a Laravel Nova project?
- Install the package with Composer using composer require henriquemattia/moeda-br. Because it is a Laravel Nova field, you need a Laravel application with Nova already installed and configured. Follow the README for any additional asset publishing or registration steps.
- Which Laravel and Nova versions does this Brazilian currency field support?
- The package is built as a Nova custom field, so the supported Nova version is the main constraint. Check the composer.json and README for the exact version requirements before installing. Your Laravel version must also match what your installed Nova release supports.
- How do I add the BRL currency mask field to a Nova resource?
- Use the field class provided by the package in your Nova resource's fields method, following the exact class name and options shown in the README. Nova will then render the Brazilian currency mask on the create and update forms. Review the package source or documentation for any field-specific configuration methods.
- Does henriquemattia/moeda-br store formatted values or raw numbers in the database?
- That depends on how the field is implemented, so check the README and the field's fill and resolve logic before choosing a column type. A common approach is to store monetary values as integer cents or as a decimal column, then format them for display. Avoid storing localized strings like R$ 1.234,56 in numeric database columns unless the package explicitly supports it.
- Can I use the BRL formatting and parsing helpers outside Laravel Nova?
- The package includes helpers for formatting, parsing, and validating Brazilian monetary values, which are plain PHP and can be used in controllers, form requests, and Blade views. Check the README for the exact function or class names before using them. This makes the package useful even when the Nova field is not the primary feature you need.
- Does the package handle the Brazilian format with dot thousands separators and comma decimals?
- Yes, the package targets Brazilian currency (BRL), which uses a dot as the thousands separator and a comma as the decimal separator, for example R$ 1.234,56. The Nova mask field is intended to guide users to enter values in that format. Use the package's parsing helpers when you need to convert the displayed value back to a numeric representation.
- How do I validate Brazilian currency input in a Nova form?
- The package provides helpers for validating monetary values in reais according to its documented behavior. In Nova, you can combine those helpers with standard Laravel validation rules on the underlying resource request. Always test the validation path with values such as zero, large amounts, and malformed input strings.
- How do I test a Laravel Nova resource that uses this currency mask field?
- Write feature tests that submit formatted Brazilian currency values through your Nova endpoints and assert the stored database values. You can also unit test the package's formatting and parsing helpers directly for faster coverage. Remember that Nova tests usually require authentication and a configured Nova environment.
- What are alternatives to henriquemattia/moeda-br for handling money in Laravel?
- General-purpose money libraries such as brick/money or akaunting/money handle arithmetic, currency conversion, and internationalization, but they are not Nova mask fields. This package is narrower: it focuses on Brazilian currency input in Nova plus BRL formatting and parsing helpers. Use it for straightforward BRL fields and pair it with a money library if you need complex monetary calculations.
- Is henriquemattia/moeda-br actively maintained and safe for production use?
- Check the GitHub repository and Packagist page for the latest release date, open issues, and compatibility with your Nova version before adopting it. For production, pin a specific version in composer.json and run your test suite against the field's formatting, parsing, and validation behavior. If the package has not been updated for your Nova release, verify it still works or consider a maintained alternative.