@@ -30,68 +30,14 @@ on when these events are triggered. You can find the examples of such
30
30
implementations from [ here] ( examples ) .
31
31
32
32
# Quick examples
33
- ## Generate settings for a given site
33
+ ### Generate settings with default credentials for the default site:
34
34
```
35
- <?php
36
-
37
- /**
38
- * @file
39
- * Include DRS settings.
40
- */
41
-
42
- use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
43
- use Acquia\Drupal\RecommendedSettings\Settings;
44
-
45
- // Create settings object.
46
- $siteUri = "site1";
47
- $settings = new Settings(DRUPAL_ROOT, $siteUri);
48
-
49
- try {
50
- // Call generate method.
51
- $settings->generate();
52
- }
53
- catch (SettingsException $e) {
54
- echo $e->getMessage();
55
- }
35
+ ./vendor/bin/drush init:settings
56
36
```
57
37
58
- ## Generate settings for a given site passing database credentials
59
-
38
+ ### Set up a new site with custom credentials for the local environment:
60
39
```
61
- <?php
62
-
63
- /**
64
- * @file
65
- * Include DRS settings.
66
- */
67
-
68
- use Acquia\Drupal\RecommendedSettings\Exceptions\SettingsException;
69
- use Acquia\Drupal\RecommendedSettings\Settings;
70
-
71
- // Create settings object.
72
- $siteUri = "site1";
73
- $settings = new Settings(DRUPAL_ROOT, $siteUri);
74
-
75
- // Database details.
76
- $dbSpec = [
77
- 'drupal' => [
78
- 'db' => [
79
- 'database' => 'drupal', // In case of multi-site database name is replaced with the site name.
80
- 'username' => 'drupal',
81
- 'password' => 'drupal',
82
- 'host' => 'localhost',
83
- 'port' => '3306',
84
- ],
85
- ],
86
- ];
87
-
88
- try {
89
- // Call generate method passing database details.
90
- $settings->generate($dbSpec);
91
- }
92
- catch (SettingsException $e) {
93
- echo $e->getMessage();
94
- }
40
+ ./vendor/bin/drush init:settings --database=site1 --username=myuser --password=mypass --host=127.0.0.1 --port=1234 --uri=site1
95
41
```
96
42
97
43
# License
0 commit comments