Get Licenses of PHP Packages using Composer

Get Licenses of PHP Packages using Composer

Keeping track of software licenses is an important part of maintaining any PHP project. When working with third-party packages, it's essential to understand the licensing terms to ensure compliance and avoid legal issues. Composer makes this process straightforward by providing a built-in command to list the licenses of all installed dependencies. This tutorial explains how to get licenses of PHP packages using Composer.

To display the licenses of all dependencies in the project, run the following command:

composer licenses

This command scans the installed packages and outputs a structured list showing each package along with its associated license.

Here's a sample of what the result might look like:

doctrine/deprecations              1.1.5   MIT          
doctrine/lexer                     3.0.1   MIT          
egulias/email-validator            4.0.4   MIT          
monolog/monolog                    3.10.0  MIT          
myclabs/deep-copy                  1.13.4  MIT          
nikic/php-parser                   v5.7.0  BSD-3-Clause 
phar-io/manifest                   2.0.4   BSD-3-Clause 
phar-io/version                    3.2.1   BSD-3-Clause 
...

Leave a Comment

Cancel reply

Your email address will not be published.