wilsilva / money by wilsilva

My first package, convert and management number in money
103
5
2
Package Data
Maintainer Username: wilsilva
Maintainer Contact: williamsilva808@hotmail.com (William Silva)
Package Create Date: 2016-12-09
Package Last Update: 2019-10-02
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-18 15:00:05
Package Statistics
Total Downloads: 103
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 5
Total Watchers: 2
Total Forks: 4
Total Open Issues: 4

Laravel Convert Money

Latest Stable Version Latest Unstable Version Total Downloads License composer.lock

Introduction

My first package, convert number in money.

Installation

To install Money, just run the following command:

	composer require wilsilva/money

Configuration

After installing the Money library, register the WilSilva\Money\MoneyServiceProvider in your config/app.php configuration file:


'providers' => [
    // Other service providers...

    WilSilva\Money\MoneyServiceProvider::class,
],

Add the MoneyFacade facade to the aliases array in your app configuration file:

'Money' => WilSilva\Money\Facade\MoneyFacade::class,

To publish the config settings in Laravel 5 use:

	php artisan vendor:publish --provider="WilSilva\Money\MoneyServiceProvider"

If you change type money, only to change in config/money.php


<?php //config file

return [
	'money-type' => 'USD', // change to BRL for example
];

	

Usage


	echo Money::convertNumberToMoney(99.90); // dump $ 99,90
	// or
	echo Money::convertMoneyToNumber("$ 99,90"); // dump float 99.90

Helpers

 convert_number_to_money(15.50, "BRL") // dump R$ 15,50

 convert_money_to_number("R$2000,00", "BRL") // dump 2000.00

 offer_descount("$100,00", 20, "USD") // $ 80,00

License

The Money Library is open-sourced software licensed under the MIT license.