Category: Uncategorized

How To Install and Use PHP Composer on Ubuntu 18.04

Introduction

PHP Composer is an application that tracks dependencies for a project. It does not replace system package managers like apt or yum.

Composer allows you to specify a set of libraries for a specific project then identifies the versions and dependencies and installs them.

This guide will show you how to install and get started with PHP Composer in Ubuntu 18.04.

tutorial on installing and using php composer on ubuntu

Prerequisites

Steps For Installing PHP Composer on Ubuntu

Step 1: Update Local Repository

Start by updating the local repository lists by enter the following in a command line:

sudo apt-get update

Step 2: Download the Composer Installer

To download the Composer installer, use the command:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Step 3: Verify Integrity of the Download

1. Visit the Composer Public Keys page. Copy the Installer Signature (SHA-384).

2. Set the code shell variable:

COMPOSER=48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5

3. Run the script below to compare the official hash against the one you downloaded:

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$COMPOSER') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

The script will either tell you the download is verified, or that it has been corrupted. If it’s corrupted, re-download the file.

Step 4: Install PHP Composer

1. Installing PHP Composer requires curl, unzip, and a few other utilities. Install them by entering the following:

sudo apt-get install curl php-cli php-mbstring git unzip
install supporting software for composer

Install Composer as a command accessible from the whole system.

2. To install to /usr/local/bin. enter:

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

The installer should output:

All settings correct for using Composer
Downloading...

Composer (version 1.6.5) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

3. Once the installer finishes, verify the installation:

composer --version

The system should output the version number installed, for example:

Composer version 1.8.6 2019-6-11 15:03:05

4. To remove the installer:

php -r “unlink(‘composer-setup.php’);”

Basic Composer Usage

Composer is designed to track dependencies on a per-project basis. This makes it easier for other users to create the same environment. Composer uses a composer.json file to keep track of required software and allowed versions.

It also uses a composer.lock file to maintain consistency if someone copies the directory. These files are automatically generated using the require command.

1. Open a terminal, and enter the following:

mkdir c_sample
cd c_sample

2. Next, you’ll need to choose a package to load. The website packagist.org has a broad range of different PHP packages for download. In this example, let’s use the monolog/monolog package. You can follow the instructions, or search the website for monolog.

3. In the terminal window, enter:

composer require monolog/monolog

The system will download the software and create the composer.json and composer.lock files.

Note: Monolog is a package for managing logfiles. The name before the slash is the vendor, and the name after the slash is the package name.

4. Once the process completes, list the contents of the directory:

ls -l

You should see the composer.json and composer.lock files, along with a vendor directory.

5. To view the contents of the composer.json file:

cat composer.json

The system will show you that it has added the monolog software. The carat ^ sign beside the version number indicates the minimum version of the software.

Setting Up Autoloading

PHP doesn’t automatically load classes. However, you can configure Composer to autoload classes for you. This makes working with dependencies much easier.

1. Create a new file using your favorite text editor:

sudo nano composer_sample.php

2. Enter the following into the file:

<?php

require __DIR__ . '/vendor/autoload.php';

use Monolog\Logger;

use Monolog\Handler\StreamHandler;

 

// create a log channel

$log = new Logger('name');

$log->pushHandler(new StreamHandler('/~/c_sample/text.log', Logger::WARNING));

 

// add records to the log

$log->warning('Foo');

$log->error('Bar');
example of autoloading classes

3. Write the file (Ctrl+O), and exit (Ctrl+X).

4. Now you can run the command to autoload monolog:

php composer_sample.php

Updating Dependencies

To update all the dependencies in your composer.json file enter the command:

composer update

This will update all dependencies according to the version specified in the file.

To update one (or more) dependencies individually:

composer update vendor/package vendor_b/package_b

Conclusion

Now you have a good understanding of how to install and start using PHP Composer. We also covered setting up autoloading and updating dependencies.

alexa

[pmpro_levels]

The Most Traded Currency Pairs in Forex ({{current-year}})

More than 50% of trades in Forex market somehow involve the US dollar.

In fact, EURUSD is the most traded currency pair in the world that takes about 30% of the total multi-billion dollar Forex turnover. And it is not surprising, since the economies of the US and the European Union are the largest ones.

Traders prefer such currency pairs because their liquidity and thereby trading conditions are better than that of other pairs.

Probably, everyone would keep trading EURUSD only, if there was no need for diversification.

That is why traders also use other currency pairs. Moreover, their trading volume correlates with the size of the economy in corresponding countries.

So, the British pound, the Japanese yen, the Swiss franc, the Australian, and the Canadian dollars will make up the most actively traded currency pairs together with the US dollar and the Euro.
[ads slot=”ssi-in-article”]

What are the Most Actively Traded Currency Pairs in Forex?

The top 10 most popular currency pairs include the Major ones, as well as several Cross currency pairs.

The most traded pairs broken down by categories:

  • Among the Major pairs and in general – EURUSD;
  • Among the Minor pairs – EURJPY;
  • Among the Exotic pairs – USDHKD.

The full list of top traded currency pairs, as well as their approximate trading volume, is available in the following table:

The most traded currency pairs by volume (2019)
# Currency Pair Volume, %
1 EURUSD 27.95%
2 USDJPY 13.34%
3 GBPUSD 11.27%
4 AUDUSD 6.37%
5 USDCAD 5.22%
6 USDCHF 4.63%
7 NZDUSD 4.08%
8 EURJPY 3.93%
9 GBPJPY 3.57%
10 EURGBP 2.78%
11 AUDJPY 2.73%
12 EURAUD 1.8%
13 EURCHF 1.73%
14 AUDNZD 0.96%
15 NZDJPY 0.93%
16 GBPAUD 0.89%
17 GBPCAD 0.81%
18 EURNZD 0.78%
19 AUDCAD 0.76%
20 GBPCHF 0.73%
21 AUDCHF 0.7%
22 EURCAD 0.7%
23 CADJPY 0.67%
24 GBPNZD 0.64%
25 CADCHF 0.58%
26 CHFJPY 0.57%
27 NZDCAD 0.48%
28 NZDCHF 0.38%

Interestingly, USD/DEM was the most widely traded currency pair before the Euro was introduced. The Deutsche Mark was the second-largest reserve currency in the world at the time, which attracted traders’ interest.

What Does Popularity of Currency Pair Affect?

First of all, actively traded pairs have high liquidity. Since more people are interested in an asset, the easier it is to buy and to sell.

High currency pair liquidity, in turn, enables trades with lower commission costs. The traders call them the trading conditions.

Thus, the EURUSD pair will commonly have the best trading conditions:

  • The lowest spread;
  • Minimum commission for rolling over open positions to the next trading day (swap);
  • No or small commission for opening a trade;
  • Fast trade execution.

Here we should also mention clearer candlestick chart formation (without gaps). It significantly influences the accuracy of the readings of all indicator kinds.

In addition to the trading conditions, the popularity of a currency pair also affects its informational visibility:

  • All sorts of analytics and expert opinions;
  • Trading forecasts and signals are preferably published for the most popular pairs;
  • Regular coverage of events in the news media and reviews;
  • Most guides provide examples specifically for major currency pairs;
  • And so forth.

It is often argued that the top traded pairs are also the most predictable ones. However, this fact is not supported and is based mainly on guesses.
[ads slot=”ssi-in-article”]

The Most Traded Pairs by Region

Most Traded Currency Pairs

The chart shows the currency pairs activity depending on the time of the day. The pairs were selected in such a way as to visually demonstrate the influence of a region on the “tradability” of a pair.

What’s interesting about the chart?

  • The most active trading hours in the Forex market are 7:00-16:00 (UTC). You can expect to achieve the goals within this period. While the lowest level of currency pairs movement is from 3:00 to 7:00 (UTC).
  • The peak of currency pairs’ activity is observed when the London and the New York trading sessions overlap. The most “traded time” is 15:00 (UTC).
  • If countries have the same trading sessions (working hours), the currency pair will be actively traded only within the given session. As you can see in the chart above, USDCAD ignores the London session opening. Other pairs – EURGBP and AUDNZD – do the same.

Install the trading session indicator directly in MT4. By doing so, you won’t have to constantly look at your watch or measure the trading session duration to determine the most active trading time for the selected pair.

The Least Traded Pair

We have listed the most traded currency pairs, but can we identify the least traded ones?

Each list has its first and last number. However, things aren’t that simple when it comes to currency pairs.

To date, there are about 180 different currency names in the world. So, the number of possible currency pair combinations is 16,110.

Hypothetically, we can assume that the SZL/VUV (the Eswatini Lilangeni/the Vanuatu Vatu) pair may be the world’s least traded one. We can also say the same for hundreds of other extremely exotic pairs. However, it’s not possible to determine exactly which one is traded the least.

If we limit the list only to Forex pairs (available in the trading terminal), the least traded ones will be the following:

  • Among the Major pairs – NZDUSD;
  • Among the Minor pairs – NZDCHF;
  • Among the Exotic pairs – GBPHUF.

These pairs have shown the minimum trading volume at the time of this writing.

In Conclusion…

The popularity of a currency pair provides the best trading conditions. Therefore, to start, you better use such pairs.

When choosing a currency pair, make sure to analyze its intraday activity. Some of them are traded only at a specific time of the day.

The trading volume of a currency pair is not a constant value. The numbers and values given in the article were gathered during the writing and may change over time.

title: Most Traded Currency Pairs by Volume ({{current-year}}) – Pie Chart

description: What are the most commonly traded currency pairs in the world? List of 20 the most heavily traded Forex pairs by volume in {{current-year}}. How does the popularity of a currency pair affect trading results? Also, find out which currency pairs are the least traded.