Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to install packages using composer from local git repository

    Composer is tool used to manage dependencies and file autoloading in your PHP project, it simply allows you to download packages from multiple repositories using composer.json file, by default it uses the packagist repository to search and install the packages, but uploading all the projects on packagist and then downloading from there sometimes not feasible, since you just need to test the project if it is working fine when installed from composer, since a huge project can have multiple requirements and dependencies so it is vital to test composer dependencies before offering it to the customer because if your project fails at the time of installation it will create a bad impression.

    Since mostly all the projects are managed on git, svn it will be best to install the packages directly from the local git repository.So let’s see how we can do that, first of all, you need to install composer on your system, please follow this link for installation.

    Composer allows you to define different types of repositories check here

    to allow downloading from local repositories you must use type vcs, which will allow you to install packages directly from the private repository. I will explain the commands that you can use to install packages from local git repo:


    Using above commands you can install from the private git repository, in the above commands the first one is  to define the repository url, you can use your local repo file system path or ssh path as well, but to use ssh path you must add your system ssh key your git repo deploy keys, follow this link for better understanding.

    In the second command we are simply requiring the package with name company/package and to specify the branch name we used dev-branch-name prefix “dev-” is fix and rest is branch name. The sample composer.json in the package will look like this:


    the above is a very basic composer file just to show you the package name, there can be a lot more options.

    Hope this will help you in module development and testing.

    Thanks 🙂 .

     

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close