Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Several Drupal core subsystems were converted to the PHP PSR-4 standard. PSR-4 is an emerging standard for organizing and loading PHP classes using namespaces that is robust, relatively easy to understand, and far less brittle and error-prone than Drupal 7's Registry system.

In practical terms, this means a bunch of classes got renamed, and they are now namespaced. See namespace rules.

In general, this should not impact module developers unless you are extending from one of these classes. For example, if you are Media: YouTube module implementing your own stream wrapper to save/load files from YouTube. Modules specifying a particular class by name will also need to add a use statement for the namespace at the top of the file.

The table below shows where each system can now be found:

Subsystem Namespace
Archiver Drupal\Component\Archiver
Cache Drupal\Core\Cache
Database Drupal\Core\Database
DrupalCacheArray Drupal\Core\Utility
DrupalQueue Drupal\Core\Queue
FileTransfer Drupal\Core\FileTransfer
Lock Drupal\Core\Lock
Mail Drupal\Core\Mail
StreamWrapper Drupal\Core\StreamWrapper
Updater Drupal\Core\Updater
UUID Drupal\Component\Uuid
Graph Drupal\Component\Graph\Graph

Note, a "Core" namespace indicates subsystems that are Drupal-specific. "Component" indicates subsystems re-usable outside of Drupal without modification.

(Note also that Drupal core modules are always namespaced by the module name. See PSR-4 Class Loader in core for more information.)

Example (use statement)

// Drupal 7:
function mymodule_query_alter(QueryAlterableInterface $query) {
  // ...
}

// Drupal 8:
use Drupal\Core\Database\Query\AlterableInterface;
// ...
function mymodule_query_alter(AlterableInterface $query) {
  // ...
}
Impacts: 
Module developers