Download the PHP package akeneo/measure-bundle without Composer

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

MeasureBundle

Akeneo Measure Bundle : manage measure units in families and conversions from a unit to another

Allows to :

Scrutinizer Quality Score Code Coverage Build Status

Akeneo PIM

Originally written to be used in Akeneo PIM.

This extraction aims to make it usable outside of the Akeneo PIM project.

Please consider that this process is still in a very experimental stage.

We don't have all the tests and automation which could ensure that this component will work smoothly outside of the Akeneo PIM full stack.

Documentation

Documentation is available on docs.akeneo.com

General operation

This bundle to convert a value from a unit to another. Some families and units are already defined but it's possible to add others families and units to convert anything.

Converter converts a value from a unit to a standard unit (sort of reference unit) then from standard unit to asked unit. This allows to define just one list of operations to convert each unit.

Operations are defined to convert from the unit to the standard unit. Converter convert to standard unit with default operations order but reverse order and do the opposite operation (addition <=> substraction and multiplication <=> division). We used strings to define operations. 'add', 'sub', mul', 'div' are allowed.

You can add more operations extending bundle.

Classes and files

In MeasureBundle :

Configuration file can be seen https://github.com/akeneo/MeasureBundle/blob/master/Resources/config/measure.yml

Install and run unit tests

To run tests :

Convert a value

A service is defined to use converter. You must call it and define the family to use before convert a value. In the example below, we convert a value in kilometers to miles.

Get the whole list of families and units

Add unit to an existing family

To define a new unit in an existing family, it's just necessary to define it and their units in a new config file named measure.yml in your own bundle. For example, in our demo bundle, we add the below code :

Here, we just had "Dong" unit with his conversion rules from it to standard unit. To have equivalent to 1 dong in meters, you must multiply by 7 and divide by 300. A symbol is required too to define unit format to display. Optionally but recommended, a new class extending family class can be created. It allows to use converter with constants instead of strings. Contants represent config values. Here we created "MyLengthMeasure" new class extending LengthMeasure to add "Dong" unit constant.

Then, you can call a conversion to your new unit like this :

Create a new family

To create a new family, it's like to add a unit to an existing family. It's necessary to add configuration in measure.yml file of your bundle and optionally a class defining constants to be used instead of strings.

Exceptions thrown

Exceptions are thrown if we encountered problems during conversion.

Divisions by zero don't throw exceptions but are ignored.

Extend converter

This bundle is extensible and we can imaginate config recovering from database or services or use converter for currencies for example.

Issues & Contributing

This bundle is developed in our main repository.

If you encounter any bug, please check if it's already known before to create a new issue.

If you want to contribute (and we will be pleased if you do!), you'll find more information on this page.

About versioning, the version 0.6.x is developed in akeneo/pim-community-dev 1.6.x.

For older versions,

OSL Licence

Licence can be found Here.


All versions of measure-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
symfony/symfony Version >=2.1.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 akeneo/measure-bundle contains the following files

Loading the files please wait ....