You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Moving all PHP files out of the docroot](https://www.drupal.org/node/2767907)
14
14
-[#1672986: Option to have all php files outside of web root](https://www.drupal.org/node/1672986)
15
15
16
16
## Requirements
17
-
Except for Windows, this plugin should work on environments that have Composer support. [Windows support issue](https://github.com/drupal-composer/drupal-paranoia/issues/5).
17
+
Except for Windows, this plugin should work on environments that have Composer support. Do you use Windows? [Help us](https://github.com/drupal-composer/drupal-paranoia/issues/5).
18
18
19
-
## Configuration
19
+
## Installation
20
20
Make sure you have a based [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) project created.
21
21
22
-
Rename your current docroot directory to `app`.
22
+
Rename your current docroot directory to `/app`.
23
23
```
24
+
cd drupal-project-root
24
25
mv web app
25
26
```
26
27
27
-
Update the `composer.json` of your root package with the following changes:
28
+
Update the `composer.json` of your root package with the following values:
Done! The plugin and the new docroot are now installed.
52
56
53
-
### Optional Configurations
57
+
### Asset file types
58
+
The asset files are symlinked from `/app` to `/web` folder.
54
59
55
-
#### Modify the asset file types
60
+
Default asset file types are provided by the plugin:
61
+
```
62
+
robots.txt
63
+
.htaccess
64
+
*.css
65
+
*.eot
66
+
*.ico
67
+
*.gif
68
+
*.jpeg
69
+
*.jpg
70
+
*.js
71
+
*.otf
72
+
*.png
73
+
*.svg
74
+
*.ttf
75
+
*.woff
76
+
*.woff2
77
+
```
56
78
57
79
To extend the list of assets file types you can use the `asset-files` config:
58
80
```json
59
81
"extra": {
60
-
"...",
61
82
"drupal-paranoia": {
62
83
"app-dir": "app",
63
84
"web-dir": "web",
@@ -70,8 +91,7 @@ To extend the list of assets file types you can use the `asset-files` config:
70
91
}
71
92
```
72
93
73
-
If you need to modify it you can use the
74
-
`post-drupal-set-asset-file-types` event:
94
+
If you need to modify the list you can use the `post-drupal-set-asset-file-types` event:
75
95
```json
76
96
"scripts": {
77
97
"post-drupal-set-asset-file-types": [
@@ -104,12 +124,26 @@ class ScriptHandler {
104
124
}
105
125
```
106
126
107
-
#### Plugin events
127
+
By the purpose of this plugin, the following files types are __not allowed__ and if listed they will be ignored:
128
+
```
129
+
*.inc
130
+
*.install
131
+
*.module
132
+
*.phar
133
+
*.php
134
+
*.profile
135
+
*.theme
136
+
```
137
+
138
+
### Web server docroot
139
+
Change the document root config of your web server to point to `/web` folder.
140
+
141
+
## Plugin events
108
142
This plugin fires the following named event during its execution process:
109
143
110
144
-__drupal-paranoia-post-command-run__: Occurs after the command `drupal:paranoia` is executed.
111
145
112
-
#####Example of event subscriber
146
+
### Example of event subscriber
113
147
114
148
```php
115
149
<?php
@@ -146,22 +180,18 @@ class MyClass implements PluginInterface, EventSubscriberInterface
146
180
}
147
181
```
148
182
149
-
## Folder structure
150
-
Your project now is basically structured on two folders.
151
-
-__app__: Contains the files and folders of the full Drupal installation.
152
-
-__web__: Contains only the __symlinks of the assets files__ and the __PHP stub files__ from the `app` folder.
183
+
## Local development
184
+
Every time you install or update a Drupal package via Composer, the `/web` folder will recreated.
153
185
154
-
Every time that you install or update a Drupal package via Composer, the `web` folder is automatically recreated.
186
+
```
187
+
composer require drupal/devel:~1.0
188
+
> drupal-paranoia: docroot folder has been rebuilt.
189
+
```
155
190
156
-
If necessary, you can rebuild it manually, running the command
191
+
When working with themes, CSS and JS for example, it may be necessary to rebuild the folder manually to symlink the new assets.
157
192
```
158
193
composer drupal:paranoia
159
194
```
160
195
161
-
This could be necessary when updating themes images, CSS and JS files.
162
-
163
196
### Public files
164
197
This plugin assumes that the public files folder exists at `app/sites/<site>/files` and symlinks `web/sites/<site>/files -> ../../../app/sites/<site>/files`.
165
-
166
-
## Important
167
-
The document root configuration of your web server should point to the `web` path.
0 commit comments