定制 aharen/laravel-money 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aharen/laravel-money

Composer 安装命令:

composer require aharen/laravel-money

包简介

Simple class with Facade to handle money for Laravel 5.2

README 文档

README

Simple class with Facade to handle money for Laravel 5. The class stores and calculates all money related value (eg: prices etc..) in Laari (Pennies)

Installation

composer require aharen/laravel-money

Configuration

  1. Add MoneyServiceProvider to providers in config/app.php

    aharen\Money\MoneyServiceProvider::class,

  2. Add Money Facade to aliases in config/app.php

    Money => aharen\Money\MoneyManagerFacade::class,

Usage

Initiate from either Rufiyaa

$money = Money::fromRufiyaa(10);

or Laari

$money = Money::fromLaari(1000);

Addition

Expects the provided ammount to be added in Laari

Money::fromRufiyaa(20)
         ->add(100) // 1 rufiyaa
         ->inRufiyaa();

Adding other money objects

Money::fromRufiyaa(20)
         ->add(Money::fromRufiyaa(20.5))
         ->inRufiyaa();

Subtraction

Expects the provided ammount to be subtracted in Laari

Money::fromRufiyaa(20)
         ->subtract(100) // 1 rufiyaa
         ->inRufiyaa();

Subtracting other money objects

Money::fromRufiyaa(20)
         ->subtract(Money::fromRufiyaa(5)
         ->inRufiyaa();

Multiplication

Expects the provided ammount to be multiplied in Laari

Money::fromRufiyaa(2)
      ->multiply(200) // 2 rufiyaa
      ->inRufiyaa();

Multiplying other money objects

Money::fromRufiyaa(20)
       ->multiply(Money::fromRufiyaa(5))
       ->inRufiyaa();

Division

Expects the provided ammount to be multiplied in Laari

Money::fromRufiyaa(4)
       ->divide(200) // 2 rufiyaa
       ->inRufiyaa();

Dividing other money objects

Money::fromRufiyaa(4)
       ->divide(Money::fromRufiyaa(2))
       ->inRufiyaa();

Chaining Methods

You have the ability to manipulate the values in a chainable way.

Money::fromRufiyaa(20)
       ->add(200) // 2 rufiyaa
       ->subtract(100) // 1 rufiyaa
       ->inRufiyaa();

Output

There are 3 output options available:

  1. Output in Laari
	$money->inLaari();
  1. Output in Rufiyaa
   $money->inRufiyaa();
  1. Output in Rufiyaa and Laari
	$money->inRufiyaaAndLaari();

统计信息

  • 总下载量: 240
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固