sunstrike/converter

v0.3.0 2024-09-12 16:57 UTC

This package is not auto-updated.

Last update: 2025-07-17 21:54:12 UTC


README

Overview

This is a library for converting any unit to another. All the units and their precission are costomizable just by updating units database. current version supports conversion for:

  • Weight
  • Length

Insallation

You can install this package by running following composer command:

composer require sunstrike/converter

Examples

Weight conversion:

<?php

use Sunstrike/Converter/Convert;

$grams = Convert::weight(10)->from('kg')->to('g'); // 10,000 grams

Length conversion:

<?php

use Sunstrike/Converter/Convert;

$miles = Convert::length(100)->from('km')->to('mi'); // 62.137 miles

Pressure conversion:

<?php

use Sunstrike/Converter/Convert;

$miles = Convert::pressure(1)->from('bar')->to('pa'); // 100000 pascals