Download the PHP package tankertrackers/convert without Composer

On this page you can find all versions of the php package tankertrackers/convert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package convert

Convert

This package is mainly concerned with converting between the following three units of measurement:

It was developed to be compatible with PHP 8.0 and greater and is intentionally as light-weight as possible, not requiring any external dependencies or relying on any non-standard PHP libraries.

Please note that future versions may require PHP 8.1 and greater due to the built-in support for Enums that it offers. A new Major release of this library will be released if PHP version dependencies change. At the moment, no significant changes are planned that would require this package to require PHP 8.2 or greater.

Installation

Usage

If you are doing calculations on an oil grade with a specific gravity (relative density) of 0.983, you can create an Gravity object by calling on the appropriate static method on the TankerTrackers\Convert class like so: Convert::gravity(0.983). If you wanted to see the corresponding API value for this Gravity value, you can instead call Convert::gravity(0.983)->toApi().

Converting all three measurements between each other is done in the same way, and all three methods - ->toApi(), ->toBpt(), and ->toGravity() - are available on all three measurements.

Note that the $value attribute is always returned as a float; even if the value is 1.0 it is not cast to an int.

You can also access the values directly by calling ->apiValue(), ->bptValue() or ->gravityValue(). This gives the same value as converting to that measurement type and accessing the $value attribute:

Future Development

Api Grade Categories

In the future, this package may see some additional bells and whistles when it comes to analyzing the values of the various measurements. For example, the ApiGrade class might offer a ->getCategory() method so that something like this is possible:

Pre-defined Listings

I might also consider adding a number of well known oil grades via Enum classes so that one can reference values directly, something like:

Improvements to Value Checking

At the moment, the system trusts that the values you are entering are valid for that category, so it has no reason to suspect anything is weird if you ask it to create a BarrelsPerTonne object with the value of -718. Some sanity checks could be implemented that catch scenarios like this and throw Exceptions when we know something is out of the ordinary.

Copyright / License

This library is released under an MIT License. See the LICENSE file for further details.


All versions of convert with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tankertrackers/convert contains the following files

Loading the files please wait ....