Skip to main content

Install or Update Behat using composer

For Behat you need at least PHP 5.3.3 version installed on your system. No matter you install Behat on Window, Mac or Ubuntu, steps will remain same.There are multiple ways to install Behat, The simplest way to install Behat is through Composer. Please install the composer on your OS if not installed already.

Advantage of installing Behat using composer is that you can easily update to latest version later. Below are the steps:

Step 1: Create composer.json in your project root directory.

Step 2: Add following json in composer.json.

{
    "require-dev": {
        "behat/behat": "~2.5"
    },
    "config": {
        "bin-dir": "bin/"
    }
}

Step 3: Replace 2.5 with the latest Behat version, which you can check here 

Step 4: Use below command to install libraries: 

$ composer install

For update Behat, add the latest version from link to the composer.json file and use below command.

$ composer update

Step 5: To check version of Behat use below command.

$ bin/behat --version

Tags
Submitted by tgoswami on September 15, 2020

Tarun has 11+ years of experience in Quality Assurance in different domains like Banking, E-commerce, Health and Education.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.