PHP - Including External Packages

To build complex applications in PHP, it is much quicker and simpler to just "glue together" relevant packages and configure them.

Related Posts

Steps

    Navigate to the root of your project's directory, or just create a new directory if you are starting from scratch.
    mkdir -p /path/to/project/directory
    cd /path/to/project/directory
    
    Create a composer.json file, listing all the packages that you require. If you are hosting your own private repository using Satis, you will need to list this as well using the
    repositories
    section as I have done below.
    {
        "repositories": [ { "type": "composer", "url": "http://satis.technostu.com/" } ],
        "require": {
            "Programster/CoreLibs": "dev-trunk",
            "Programster/CliMenu": "1.0.0",
            "Programster/DigitalOceanSdk": "2.*"
        }
    }
    
    Download all the packages using composer.
    composer update
    Running composer update again later may result in packages updating, especially if you use versions like
    dev-trunk
    or
    2.*
    , so using specific versions like
    1.0.0
    is somewhat safer!

No comments:

Post a Comment