简体   繁体   中英

How to manage dependencies for a Php application?

I have a php application that requires that the server that it runs in has php5-imagick and php5-mcrypt installed and enabled. What kind of tool can I use that will look if those two are installed or not and if it is not then install them? I don't what these tools are called that is why I am not being very specific? Thanks in advance.

You can use composer, look up the documentation at https://getcomposer.org/

Once installed you can create a composer.json file in the project root which defines exactly what you need in order for the application to run. For example:

{
    "name": "Foo\Bar",
    "require": {
        "php": ">=5.4.0",
        "ext-imagick": "*"
    }
}

Then run: Composer install

It'll tell you if the dependencies in the "require" section haven't been met. You'd still have to install php5-* things manually but it's a good guide.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM