Home > Development Tools > composer > 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

藏色散人
Release: 2021-07-12 15:32:09
forward
2031 people have browsed it

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"
        }
    }
Copy after login

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!

Related labels:
source:jianshu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template