Giter Club home page Giter Club logo

drupal-recommended-settings's Introduction

Acquia Drupal Recommended Settings

The Acquia Drupal Recommended Settings plugin adds the recommended settings to the Drupal project, so developers won't have to edit settings.php manually.

The recommended settings includes:

  • The required database credentials.
  • Configuration sync directory path.
  • File directory path i.e public/private etc.
  • Acquia site studio sync directory path.

It allows your websites to be easily installed in both Acquia Cloud IDE & local and deployable on Acquia Cloud.

Installation

Install using Composer

composer require acquia/drupal-recommended-settings

Multi-site features with Acquia DRS

The Drupal Recommended Settings offer the multi-site feature out of the box. To configure a multi-site, run the following command, and the plugin will automatically generate the settings.php in the backend.

drush site:install --uri site1

The plugin offers various events that allow you to implement custom logic based on when these events are triggered. You can find the examples of such implementations from here.

Quick examples

Generate settings for a given site

<?php

/**
* @file
* Include DRS settings.
*/

use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;

// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);

try {
 // Call generate method.
 $settings->generate();
}
catch (SettingsException $e) {
 echo $e->getMessage();
}

Generate settings for a given site passing database credentials

<?php

/**
 * @file
 * Include DRS settings.
 */

use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
use Acquia\Drupal\RecommendedSettings\Settings;

// Create settings object.
$siteUri = "site1";
$settings = new Settings(DRUPAL_ROOT, $siteUri);

// Database details.
$dbSpec = [
  'drupal' => [
    'db' => [
      'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
      'username' => 'drupal',
      'password' => 'drupal',
      'host' => 'localhost',
      'port' => '3306',
    ],
  ],
];

try {
  // Call generate method passing database details.
  $settings->generate($dbSpec);
}
catch (SettingsException $e) {
  echo $e->getMessage();
}

License

Copyright (C) 2023 Acquia, Inc.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

drupal-recommended-settings's People

Contributors

vishalkhode1 avatar rajeshreeputra avatar apathak18 avatar chandan-singh7929 avatar deepakmishra2 avatar dependabot[bot] avatar danepowell avatar vipin-mittal-acquia avatar acquia-github-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.