Skip to content

Commit 4a7b715

Browse files
committed
Add moneybatch/minimalist to Laravel
0 parents  commit 4a7b715

13 files changed

Lines changed: 4070 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Money batch for minimalist
2+
Working with one currency on Laravel? Need easy, affective and stable way to work with Money?
3+
Pick the Laravel Minimalist.
4+
5+
This is a Laravel version of [moneybatch/minimalist](https://github.com/moneybatch/minimalist)
6+
7+
## Installation
8+
`composer require moneybatch/laravel-minimalist`
9+
10+
## Usage
11+
12+
### Money
13+
`Moneybatch\LaravelMinimalist\Domain\Money` and `Moneybatch\LaravelMinimalist\Domain\Price` are extensions of [moneybatch/minimalist](https://github.com/moneybatch/minimalist) and can be used the same way. See [details](https://github.com/moneybatch/minimalist/blob/master/README.md).
14+
15+
### Eloquent: Mutators & Casting
16+
To cast the attribute to Money, just use the standard Eloquent model `casts` attribute:
17+
18+
```
19+
protected $casts = [
20+
'balance' => Money::class,
21+
];
22+
```
23+
24+
Don't forget to import the class prior to using it:
25+
`use Moneybatch\LaravelMinimalist\Domain\Money`;

composer.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"name": "moneybatch/laravel-minimalist",
3+
"description": "Moneybatch Laravel Minimalist",
4+
"keywords": [
5+
"nikolaynesov",
6+
"money",
7+
"moneybatch",
8+
"minimalist"
9+
],
10+
"homepage": "https://github.com/moneybatch/laravel-minimalist",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Nikolay Nesov",
15+
"role": "Developer"
16+
}
17+
],
18+
"require": {
19+
"php": "^7.4",
20+
"moneybatch/minimalist": "^1.0"
21+
},
22+
"require-dev": {
23+
"illuminate/contracts": "^8.69",
24+
"illuminate/database": "^8.69",
25+
"phpunit/phpunit": "^9.0"
26+
},
27+
"autoload": {
28+
"psr-4": {
29+
"Moneybatch\\LaravelMinimalist\\": "src"
30+
}
31+
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Moneybatch\\LaravelMinimalist\\Tests\\": "tests"
35+
}
36+
},
37+
"scripts": {
38+
"test": "vendor/bin/phpunit",
39+
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
40+
},
41+
"config": {
42+
"sort-packages": true
43+
}
44+
}

0 commit comments

Comments
 (0)