Download the PHP package php-unit-conversion/php-unit-conversion without Composer

On this page you can find all versions of the php package php-unit-conversion/php-unit-conversion. 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 php-unit-conversion

Php Unit Conversion

Build Status Coverage Status Latest Stable Version Total Downloads License

The php-unit-conversion/php-unit-conversion package provides full PSR-4 compatible unit conversion. Most other packages that are available for unit conversion are using string types to indicate unit types. In this package all unit types are classes.

We still need to add a lot more units and tests to make the package more usefull. If you want to help me with that, please check Contributing!

Basic Usage

Unit Conversions

Find the nearest unit type

If you have a value and want to automatically convert it to the unit type which value is closest to 1, you can use the static nearest method. The nearest method should only be called on a Unit Type class.

If you only want units from a specific measurement system, you can pass a System class name as second parameter

Storing values with their type

If you want to store values in e.g. a database, you often have to store two things: the value itself and the unit type. As all our Units have a TYPE constant defined, we can use this to add the type information to the value before storing it in the database. To retrieve this unit value you can invoke the class instance itself.

The returned value is the result of first converting the value to the base value, then a shift left by 6 and add the TYPE constant.

You can use the static from method to convert to a base unit instance again:

Arithmetic Operators

Adding custom units

Contributing

Please check Contributing for details.


All versions of php-unit-conversion with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
myclabs/php-enum Version ^1.5
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 php-unit-conversion/php-unit-conversion contains the following files

Loading the files please wait ....