PHP Classes

How to Calculate the Commissions of Financial Operations using the PHP Commission Calculator From CSV File: Get transactions from file and compute commissions

Recommend this page to a friend!
  Info   View files Example   View files View files (40)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-22 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 26 This week: 24All time: 10,692 This week: 4Up
Version License PHP version Categories
commission-calculato 1.0MIT/X Consortium ...8PHP 5, Finances, PHP 8
Description Author

This package can get transactions from files and compute commissions.

It can read a file in CSV file with the amounts of financial transactions like withdrawals and deposits.

The package can process all the transactions and return the result of calculating the total amount of commissions using rates defined in specific classes that can handle operations which each type of supported transaction type.

Picture of Maniruzzaman Akash
  Performance   Level  
Innovation award
Innovation award
Nominee: 4x

 

Details

Commission calculator

A simple commission calculator for transaction - Withdraw, Deposit using PHP-8.x - Problem

Requirements

- PHP >= 8.0

How to start

Clone the repository

git clone https://github.com/ManiruzzamanAkash/commission-calculator.git

Go to that folder

cd commission-calculator

Install composer dependencies

composer install

PHPUnit Test

I've added total 33 tests, and 37 assertions for testing codebase.

composer run phpunit

Run PHP-CS

composer run test-cs

Run both PHPUnit + PHP-CS

composer run test

PHPUnit Test Demo

Run project

From terminal, you can run this command to get the result of input.csv's datasets.

input.csv - I've stored some real data in this file for testing commission.

php script.php
input.csv

Run Live

Run with Custom Data

Create a file sample.csv at project root -

Put some data's there and save, eg:

2014-12-31,4,private,withdraw,1200.00,EUR
2015-01-01,4,private,withdraw,1000.00,EUR
2016-01-05,4,private,withdraw,1000.00,EUR
2016-01-05,1,private,deposit,200.00,EUR

Now test our script from terminal

php script
sample.csv
  Files folder image Files  
File Role Description
Files folder imagesrc (9 directories)
Files folder imagetests (4 directories)
Accessible without login Plain text file .php-cs-fixer.php Example Example script
Accessible without login Plain text file .phpunit.result.cache Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file input.csv Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file problem.MD Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file script.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:26
This week:24
All time:10,692
This week:4Up