PHP Composer Dependency Manager

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

Composer is PHP's most commonly used dependency manager. It's analogous to npm in Node, pip for Python, or NuGet for .NET.

Syntax

  • php path/to/composer.phar [command] [options] [arguments]

Parameters

ParameterDetails
licenseDefines the type of license you want to use in the Project.
authorsDefines the authors of the project, as well as the author details.
supportDefines the support emails, irc channel, and various links.
requireDefines the actual dependencies as well as the package versions.
require-devDefines the packages necessary for developing the project.
suggestDefines the package suggestions, i.e. packages which can help if installed.
autoloadDefines the autoloading policies of the project.
autoload-devDefines the autoloading policies for developing the project.

Remarks

Autoloading will only work for libraries that specify autoload information. Most libraries do and will adhere to a standard such as PSR-0 or PSR-4.

Helpful Links

Few Suggestions

  1. Disable xdebug when running Composer.
  2. Do not run Composer as root. Packages are not to be trusted.


Got any PHP Question?