A collection of lightweight drivers with a common interface for interacting with Drupal. These are generally intended for testing and are not meant to be API-complete.
Note: This
masterbranch is under heavy development for version 3.x. Drupal 6 and 7 support has been dropped. For the 2.x maintenance line, use the2.xbranch. See the 3.x epic for details and progress.
| Driver | Description |
|---|---|
| Blackbox | No Drupal bootstrap. Interacts only through HTTP. |
| Drupal API | Bootstraps Drupal directly in PHP for programmatic access to entities, fields, users, and configuration. |
| Drush | Interacts with Drupal through the Drush command line tool. |
composer require drupal/drupal-driveruse Drupal\Driver\DrupalDriver;
require 'vendor/autoload.php';
$path = './web'; // Path to Drupal root.
$uri = 'http://my-site'; // Site URI.
$driver = new DrupalDriver($path, $uri);
$driver->setCoreFromVersion();
// Bootstrap Drupal.
$driver->bootstrap();
// Create a node.
$node = (object) [
'type' => 'article',
'uid' => 1,
'title' => $driver->getRandom()->name(),
];
$driver->createNode($node);- Originally developed by Jonathan Hedstrom
- Maintainers
See GitHub Releases.
Features and bug fixes are welcome!
See CONTRIBUTING.md for more information.