Home  >  Article  >  Development Tools  >  How to modify the composer package and have it immediately reflected in the project

How to modify the composer package and have it immediately reflected in the project

藏色散人
藏色散人forward
2021-07-12 15:31:191982browse

How to modify the composer package and have it immediately reflected in the project

composer Depends on local development packages

When developing a composer package, we must We need to debug it, so we usually create a test project and introduce this package into the test project. This article introduces how to modify the composer package code to be immediately reflected in the test project.

First create the composer package project: composer init . Or manually create the composer.json file to start developing your package.

Create a test project

Configure local dependencies, add the following content in the test projectcomposer.json:

"repositories": {
        "local": {
            "type": "path",
            "url": "path/to/your/package"
        }
    }

Install this package in the test projectcomposer require your_vendor_name/your_package_name<br>

done

If you go to the vendor folder of the test project, you will find that this package is not copied here, but pointed to through a soft link The path of your package, so the code of the modified package can be directly reflected in the test project

*If you dislike the trouble of switching between two projects, you can refer togit submodule Usage Put 2 projects together for development

The above is the detailed content of How to modify the composer package and have it immediately reflected in the project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jianshu.com. If there is any infringement, please contact admin@php.cn delete