/PHP

Developing composer packages locally (enhancing or PR to someone)

I want to PR to some open source packages but I need to real testing (not by unit test) and try working correctly, so how do I do that?


Set your test folder and composer initial

You need to prepare the project purely, make your folder and initial composer:

$ composer init -q

Next, install the composer autoload

$ composer install

Specific repositories and symlink

For example, I want to enhancing or PR fzaninotto/faker, you can fork that, and clone to directory like Faker and symlink to repositories on your own.

// composer.json
"repositories": [
    {
        "type": "path",
        "url": "../Faker",
        "options": {
            "symlink": true
        }
    }
],
"require": {
    "fzaninotto/faker": "@dev"
}

Next, I add new method in my Faker locally, and I want to install it:

$ composer update fzaninotto/faker --prefer-source

Finally you can add new features or fix bugs for test in real. When you be done works that negative to Faker commit the works(creating the pull request). don’t forget writing the unit tests 😎.

Yish

Yish

The creator of yish.dev

Read More