Answers.Body: <p>According to the <a href="https://docs.civicrm.org/dev/en/master/core/architecture/#namespaces" rel="nofollow noreferrer">developer docs on namespaces</a>, the two standards represent two eras of trend in programming standards:</p>
  
  <blockquote>
    <p>CRM (e.g.: <code>CRM_Core_Invoke</code>) classes use PEAR-style class-naming conventions that were common up until PHP 5.2. Class names include underscores and MUST NOT use the PHP "namespace" directive. Use CRM style when creating classes that plug into existing CRM subsystems such as payment processors (CRM_Core_Payment) and reports (CRM_Report).</p>
    
    <p>Civi (e.g.: \Civi\API\Kernel) "Civi" classes use PHP 5.3 namespaces. They MUST use the "namespace" directive. Namespaces are designated with "\".</p>
    
    <p>...<em>snip</em>...</p>
    
    <p>The Civi namespace uses composer's PSR-0 autoloader. This autoloader does not support custom PHP overrides.</p>
  </blockquote>
  
  <p>Obviously the developer costs of a refactor are prohibitively high and fraught with inter-operability difficulties with all the extensions, PHP versions etc. (I'm frequently shocked how many organisations still run CiviCRM on an unsupported (read: insecure) version of PHP.)</p>
  
  <p>So CiviCRM started with PEAR's conventions, then jumped on the PSR-0 bandwaggon.</p>
  
  <p>PSR-0 has been <a href="http://www.php-fig.org/psr/psr-0/" rel="nofollow noreferrer">deprecated since 2014</a>, so maybe we might have <code>\CiviCrm</code> namespace soon that follows <a href="http://www.php-fig.org/psr/psr-4/" rel="nofollow noreferrer">PSR-4</a> <em>and</em> the CiviCRM brand guidelines about not shortening the name to Civi? </p>
  
  <p>It's <em>so</em> hard staying fashionable these days and CiviCRM's rocking the retro </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-11T10:34:06.130Z
Answers.LastActivityDate: 2017-05-11T10:34:06.130Z
Answers.UserDisplayName: artfulrobot
Body: <p>From a cursory glance, everything in Civi seems to be namespaced and everything in CRM is not. I'm guessing the answer has something to do with this.</p>
  
Tags: <architecture>
Title: What's the rationale behind the new Civi folder in civicrm?
ThreadText: # What's the rationale behind the new Civi folder in civicrm?
  
  (Asked by: username_0 on 2017-05-05)
  
  From a cursory glance, everything in Civi seems to be namespaced and everything in CRM is not. I'm guessing the answer has something to do with this.
  
  **Tags:** architecture
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-11. Score: 2 | Accepted answer
  
  According to the [developer docs on namespaces](https://docs.civicrm.org/dev/en/master/core/architecture/#namespaces), the two standards represent two eras of trend in programming standards:
  
  > CRM (e.g.: `CRM_Core_Invoke`) classes use PEAR-style class-naming conventions that were common up until PHP 5.2. Class names include underscores and MUST NOT use the PHP "namespace" directive. Use CRM style when creating classes that plug into existing CRM subsystems such as payment processors (CRM\_Core\_Payment) and reports (CRM\_Report).
  >
  > Civi (e.g.: \Civi\API\Kernel) "Civi" classes use PHP 5.3 namespaces. They MUST use the "namespace" directive. Namespaces are designated with "\".
  >
  > ...*snip*...
  >
  > The Civi namespace uses composer's PSR-0 autoloader. This autoloader does not support custom PHP overrides.
  
  Obviously the developer costs of a refactor are prohibitively high and fraught with inter-operability difficulties with all the extensions, PHP versions etc. (I'm frequently shocked how many organisations still run CiviCRM on an unsupported (read: insecure) version of PHP.)
  
  So CiviCRM started with PEAR's conventions, then jumped on the PSR-0 bandwaggon.
  
  PSR-0 has been [deprecated since 2014](http://www.php-fig.org/psr/psr-0/), so maybe we might have `\CiviCrm` namespace soon that follows [PSR-4](http://www.php-fig.org/psr/psr-4/) *and* the CiviCRM brand guidelines about not shortening the name to Civi?
  
  It's *so* hard staying fashionable these days and CiviCRM's rocking the retro
  
  
  ---
  
  