Download the PHP package cocolabs-sas/currency-bundle without Composer

On this page you can find all versions of the php package cocolabs-sas/currency-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 currency-bundle

Overview

This Symfony2 bundle provide a service and a twig extension to convert and display currencies.

Build Status Latest Stable Version SensioLabsInsight

Installation

Add the bunde to your composer.json file:

As of version 1.2.0, currency_format does not convert the currency anymore, it only formats the given value according to the locale. If you need to convert and format a value, please use currency_convert_format filter.

Then run a composer update:

Register the bundle with your kernel:

Configuration

Minimun configuration:

Additional options (default values are shown here):

Initialize currencies

To initialize the currencies rate in the database run the following command:

Example by using the ECB adapter, to get rates from the European Central Bank. In the command line ecb is the value returned by the getIdentifier() method of the adapter class.

Usage

Currency conversion service

Use the convert() method from the lexik_currency.converter service:

Retrieve managed configurations

In the controller, you can use the following line to retrieve an array of all managed currencies:

Twig filters

The bundle provide 3 filters to convert and format a value:

Here an example with the currency_convert_format filter.

You can also pass more arguments, to display or not decimal and the currency symbol. And you can specify the amount's currency if needed.

Load conversions rate from another source (custom CurrencyAdapter)

If you need to load conversions rates from another source you will have to create a CurrencyAdatpter and set it as the default adapter.

To create your custom adapter you will have to extend Lexik\Bundle\CurrencyBundle\Adapte\AbstractCurrencyAdapter which define 2 abstract methods:

Here an example

Then define the adapter as a service, don't forget the lexik_currency.adapter tag:

And import the currencies by using your adapter:


All versions of currency-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.5
ext-curl Version *
ext-intl Version *
ext-json Version *
ext-simplexml Version *
symfony/config Version ^4.0|^5.0
symfony/console Version ^4.0|^5.0
symfony/dependency-injection Version ^4.0|^5.0
symfony/framework-bundle Version ^4.0|^5.0
symfony/validator Version ^4.0|^5.0
twig/twig Version ^v2.14
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 cocolabs-sas/currency-bundle contains the following files

Loading the files please wait ....