<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/mongodb.architecture.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'mongodb.overview.php',
    1 => 'Architecture',
    2 => 'Architecture Overview',
  ),
  'up' => 
  array (
    0 => 'mongodb.architecture.php',
    1 => 'Driver Architecture and Internals',
  ),
  'prev' => 
  array (
    0 => 'mongodb.architecture.php',
    1 => 'Driver Architecture and Internals',
  ),
  'next' => 
  array (
    0 => 'mongodb.connection-handling.php',
    1 => 'Connections',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/mongodb/architecture.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="mongodb.overview" class="section">
  
  <h2 class="title">Architecture Overview</h2>

  <p class="simpara">
   This article explains how all the different components of the PHP driver fit
   together, from base system libraries, through the extension, and to the PHP
   libraries on top.
  </p>

  <p class="para">
   <div class="mediaobject">
    
    <div class="imageobject">
     <img src="images/f3bc48edf40d5e3e09a166c7fadc7efb-driver_arch.svg" alt="
     MongoDB PHP Driver Architecture Diagram. The lowest level of the driver is
     our system libraries: libmongoc, libbson, and libmongocrypt. The middle
     level is the MongoDB PHP extension. The upper level is PHP userland and
     includes the MongoDB PHP library and higher-level packages such as
     framework integrations and applications.
    " width="625" height="450" />
    </div>
   </div>
  </p>

  <p class="simpara">
   At the top of this stack sits a
   <a href="https://github.com/mongodb/mongo-php-library" class="link external">&raquo;&nbsp;PHP library</a>,
   which is distributed as a
   <a href="https://packagist.org/packages//mongodb/mongodb" class="link external">&raquo;&nbsp;Composer package</a>.
   This library provides an API consistent with other MongoDB
   <a href="https://www.mongodb.com/docs/drivers/" class="link external">&raquo;&nbsp;drivers</a>
   and implements various cross-driver
   <a href="https://github.com/mongodb/specifications" class="link external">&raquo;&nbsp;specifications</a>.
   While the extension can be used directly, the library has minimal overhead and
   should be a common dependency for most applications built with MongoDB.
  </p>

  <p class="para">
   Sitting below that library is a PHP extension, which is distributed through
   <a href="https://pecl.php.net/package/mongodb" class="link external">&raquo;&nbsp;PECL</a>.
   The extension forms the glue between PHP and our system libraries
   (<a href="https://github.com/mongodb/mongo-c-driver" class="link external">&raquo;&nbsp;libmongoc</a>,
   <a href="https://github.com/mongodb/mongo-c-driver/tree/master/src/libbson" class="link external">&raquo;&nbsp;libbson</a>, and
   <a href="https://github.com/mongodb/libmongocrypt" class="link external">&raquo;&nbsp;libmongocrypt</a>).
   Its public API provides only the most essential functionality:

   <ul class="simplelist">
    <li>Connection management</li>
    <li>BSON encoding and decoding</li>
    <li>Object document serialization (to support ODM libraries)</li>
    <li>Executing commands, queries, and write operations</li>
    <li>Handling cursors for command and query results</li>
   </ul>
  </p>

  <p class="para">
   <table class="doctable table">
    <caption><strong>Driver Source Code and JIRA Projects</strong></caption>
    
     <thead>
      <tr>
       <th>Project</th>
       <th>GitHub</th>
       <th>JIRA</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PHP Library</td>
       <td><a href="https://github.com/mongodb/mongo-php-library" class="link external">&raquo;&nbsp;mongodb/mongo-php-library</a></td>
       <td><a href="https://jira.mongodb.org/browse/PHPLIB" class="link external">&raquo;&nbsp;PHPLIB</a></td>
      </tr>

      <tr>
       <td>PHP Extension</td>
       <td><a href="https://github.com/mongodb/mongo-php-driver" class="link external">&raquo;&nbsp;mongodb/mongo-php-driver</a></td>
       <td><a href="https://jira.mongodb.org/browse/PHPC" class="link external">&raquo;&nbsp;PHPC</a></td>
      </tr>

     </tbody>
    
   </table>

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