Skip to content

Instantly share code, notes, and snippets.

@Codesleuth
Last active February 3, 2016 08:42
Show Gist options
  • Save Codesleuth/e59d6437b4a0046cdb26 to your computer and use it in GitHub Desktop.
Save Codesleuth/e59d6437b4a0046cdb26 to your computer and use it in GitHub Desktop.
Require dev branch in PHP with composer

Require dev branch in PHP with composer

  1. Initialise your composer

    $ php composer.phar init
  2. Require the package as normal - for this, we're demonstrating with esendex/sdk

    $ php composer.phar require esendex/sdk:1.0.*
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
      - Installing esendex/sdk (v1.0.7)
        Cloning 68ec1747466f73d88c7ae768751a03b4f3a28fce
    
    Writing lock file
    Generating autoload files
  3. Edit your composer.json and add the repository source, and set the version of the sdk to match dev-[branch] as 1.0.7 where 1.0.7 is the version you wish to target if this branch was merged to master

    {
      "name": "esendex/php-sdk-test",
      "require": {
        "esendex/sdk": "dev-Add-Survey-API-integration as 1.0.7"
      },
      "authors": [
        {
          "name": "EsendexDev",
          "email": "[email protected]"
        }
      ],
      "repositories": [
        {
          "type": "git",
          "url": "https://github.com/esendex/esendex-php-sdk"
        }
      ]
    }
  4. Update the dependencies with composer

    $ php composer.phar update
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    - Updating esendex/sdk (v1.0.7 => dev-new-feature 8c38f2d)
      Checking out 8c38f2dabaeefdf7044f85d569645680b38b9c2d
    
    Writing lock file
    Generating autoload files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment