Skip to content

vansales/uconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vansales/uconvert

Build Status License: MIT

PHP Library :: Unit Conversions for product packing

Requirement

  • PHP 7.2+

Composer

This package available on Packagist, Install the latest version with composer

composer require vansales/uconvert

Usage

$convert = new vansales\Uconvert;


// Initial set of Unit Conversion
$baseUnit = 'ชิ้น';

$convrtSet = array(
    'unit1' => 'แพ็ค',
    'unit2' => 'โหล',
    'unit3' => '',
    'conv1' => 6,
    'conv2' => 12,
    'conv3' => 0,
);

$convert->init($baseUnit, $convrtSet);


$convert->setQty(59);
$result = $convert->from_baseUnit();
print_r($result);


$convert->setQty(15);
$convert->setUnit('ลัง');
$result = $convert->to_baseUnit();
print_r($result);

Contributing

Feel free to contribute on this project, We'll be happy to work with you.

License

This bundle is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.