<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'install.composer.intro.php',
    1 => 'Introduction to Composer',
    2 => 'Introduction to Composer',
  ),
  'up' => 
  array (
    0 => 'install.php',
    1 => 'Installation and Configuration',
  ),
  'prev' => 
  array (
    0 => 'install.pecl.static.php',
    1 => 'Compiling PECL extensions statically into PHP',
  ),
  'next' => 
  array (
    0 => 'install.pie.intro.php',
    1 => 'Introduction to PIE',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'install/composer.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.composer.intro" class="sect1">
  <h2 class="title">Introduction to Composer</h2>
  <p class="simpara">
   <a href="https://getcomposer.org/" class="link external">&raquo;&nbsp;Composer</a> is a dependency manager for PHP that makes it possible
   to define third-party code packages used by a project that can
   then be easily installed and updated. It leverages the built-in
   <a href="language.oop5.autoload.php" class="link">class autoloading features</a>
   of PHP, repositories of PHP packages such as
   <a href="https://packagist.org" class="link external">&raquo;&nbsp;Packagist</a>, and common project
   layout and coding conventions.
  </p>
  <p class="simpara">
   For example, if a PHP application or website needs
   to work with <abbr class="abbrev">UUID</abbr> values,
   <a href="https://packagist.org/packages/ramsey/uuid" class="link external">&raquo;&nbsp;Ben Ramsey&#039;s
   <code class="literal">ramsey/uuid</code> package</a> that implements the
   widely known and used types of UUIDs that are defined by
   <a href="https://datatracker.ietf.org/doc/html/rfc4122" class="link external">&raquo;&nbsp;RFC 4122</a> could be used.
  </p>
  <p class="simpara">
   Briefly, this is done by creating a <code class="literal">composer.json</code>
   in the project, using Composer to install the latest version of the
   package, and including Composer&#039;s autoload script to make it available
   to the code. The <a href="https://getcomposer.org/doc/01-basic-usage.md" class="link external">&raquo;&nbsp;Composer
   &quot;Basic Usage&quot; documentation</a> goes into this in more depth.
  </p>
  <div class="example" id="example-1">
   <p><strong>Example #1 
    <code class="literal">composer.json</code> that requires a single package
   </strong></p>
   <div class="example-contents">
<div class="annotation-chunk:false javascriptcode"><pre class="javascriptcode">{
    &quot;require&quot;: {
        &quot;ramsey/uuid&quot;: &quot;^4.7&quot;
    }
}</pre>
</div>
   </div>

  </div>

 </div><?php manual_footer($setup); ?>