Using a git repo as a composer repository

Written by James McDonald

December 23, 2019

In CakePHP variable visibility is generally defined using this standard:

public $defaultConfig;
protected $_defaultConfig;
private $__defaultConfig;

Just had a situation where I had extended a class and one variable from the base class was marked as public. My VSCode editor running phpfmt with the CakePHP Coding Style enabled kept on reformatting the public variable to remove the underscore in the name.

As I can’t figure out how to turn off phpfmt’s adding and removing underscores behaviour while still keeping the CakePHP Coding style I needed to modify the original package in my own forked git repo and then point composer to the modified repository

Using a git repo as a composer repository

So here is the link so I don’t forget it

You need to have a branch in your modified repository that matches something from the origin repo ( prepended with dev- so their branch is 4.0.1-alpha

So I made changes to my repo in the 4.0.1-alpha branch and then committed the changes, created a branch named dev-4.0.1-alpha using git checkout -b dev-4.0.1-alpha and pushed it up to my repo at

Then add your tweaked repo’s URL into your composer.json in the repositories key and change the version on the original repo name to your dev-* version:

  "repositories": [
      "type": "vcs",
      "url": ""
  "require": {
    "php": ">=5.5.9",
    "cakephp/cakephp": "~3.2",
    "mobiledetect/mobiledetectlib": "2.*",
    "cakephp/migrations": "~1.0",
    "cakephp/plugin-installer": "*",
    "twbs/bootstrap": "^4.0.0",
    "holt59/cakephp3-bootstrap-helpers": "dev-4.0.1-alpha"



Submit a Comment

Your email address will not be published.

You May Also Like…


Zebra Printer Language The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...