Skip to content

jhedstrom/DrupalDriver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

52835be · Oct 21, 2024
Jul 29, 2024
Apr 8, 2016
May 17, 2018
Jul 29, 2024
Jul 29, 2024
Oct 6, 2022
Oct 21, 2024
Dec 21, 2022
Oct 15, 2014
Dec 21, 2022
Oct 21, 2024
Feb 24, 2023
Oct 13, 2022
Feb 24, 2023

Repository files navigation

Build Status

Provides a collection of light-weight drivers with a common interface for interacting with Drupal. These are generally intended for testing, and are not meant to be API-complete.

Read the full documentation

Latest Stable Version Total Downloads License Scrutinizer Code Quality

Drivers

These drivers support Drupal versions 7 and 8.

  • Blackbox
  • Direct Drupal API bootstrap
  • Drush

Installation

{
  "require": {
    "drupal/drupal-driver": "~2.0"
  }
}
$> curl -sS http://getcomposer.org/installer | php
$> php composer.phar install

Usage

<?php

use Drupal\Driver\DrupalDriver;

require 'vendor/autoload.php';

// Path to Drupal.
$path = './drupal-8';

// Host.
$uri = 'http://d8.devl';

$driver = new DrupalDriver($path, $uri);
$driver->setCoreFromVersion();

// Bootstrap Drupal.
$driver->bootstrap();

// Create a node.
$node = (object) array(
  'type' => 'article',
  'uid' => 1,
  'title' => $driver->getRandom()->name(),
);
$driver->createNode($node);

Contributing

Features and bug fixes are welcome! First-time contributors can jump in with the issues tagged good first issue.

See CONTRIBUTING.md for more information.

Release notes

See CHANGELOG.