How does Composer simplify the process of adding and updating libraries in PHP projects?

Composer simplifies the process of adding and updating libraries in PHP projects by allowing developers to declare the libraries their project depends on in a composer.json file. Composer then automatically downloads and installs the required libraries, resolving dependencies and managing versions.

// Example composer.json file
{
    "require": {
        "vendor/library": "^1.0"
    }
}