slashequip/sumy
最新稳定版本:v0.3.1
Composer 安装命令:
composer require slashequip/sumy
包简介
Simple, chainable calculation library.
关键字:
README 文档
README
Sumy is a simple, chainable calculation library.
It started as a simple class in one of our projects but after needing and implementing the class in other projects we decided to turn it into a reusable package.
Here is a quick example:
$sumy = new Sumy(); $sumy->add(100)->divide(2); $sumy->get(); // 50
Installation
You can install this package by using Composer:
composer require slashequip/sumy
Getting Started
Sumy is super simple to use, first you need to initialize an instance of Sumy in your project, you can do this a few ways:
$sumyOne = new Sumy(); $sumyOne->get(); // 0 $sumyTwo = new Sumy(100); $sumyTwo->get(); // 100 $sumyThree = new Sumy($sumyTwo); $sumyThree->get() // 100
Math
$sumy = new Sumy(1000); $sumy->add(140)->get(); // 1140
| Before | Function | After |
|---|---|---|
| 1000 | ->add(140) |
1140 |
| 1000 | ->subtract(140) |
860 |
| 1000 | ->multiply(4.6) |
4600 |
| 1000 | ->divide(50) |
20 |
| 961 | ->sqrt() |
31 |
| 24 | ->pow(50) |
576 |
Chaining
All Sumy's math methods can be chained:
$sumy = new Sumy(100); $sumy->add(400)->mulitply(4)->divide(2)->subtract(39)->sqrt()->pow(3); $sumy->get(); //29791
Licence
Copyright 2021 SlashEquip OÜ.
Distributed under the MIT licence. See LICENCE.txt for further information.
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-09