Stats

952 Contributors: 31
2017-06-16
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Composer Dependency Manager

Download php eBook

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.

Related Examples