Skip to content

Commit c69c1ec

Browse files
view.php config for production environment
laravel-zero/laravel-zero#439
1 parent 0807a4c commit c69c1ec

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

view.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,32 @@ View::make('view.name', ['foo' => 'bar']);
2424
view('view-name', ['foo' => 'bar']);
2525
```
2626

27+
## Using views in production
28+
29+
In order to use blade view in production, a `view.php` file must be added in `config` directory to specify the path where the compiled view should be stored.
30+
31+
For example:
32+
```php
33+
<?php
34+
return [
35+
'paths' => [
36+
resource_path('views'),
37+
],
38+
'compiled' => \Phar::running()
39+
? getcwd()
40+
: env('VIEW_COMPILED_PATH', realpath(storage_path('framework/views'))),
41+
]
42+
```
43+
44+
You also need to add the `resources` directory in the `box.json` file to include it in the PHAR file will be compiled:
45+
```json
46+
"directories": [
47+
"app",
48+
"bootstrap",
49+
"config",
50+
"vendor",
51+
"resources"
52+
],
53+
```
54+
2755
Full details on using the View component is available on the [main Laravel documentation](https://laravel.com/docs/views).

0 commit comments

Comments
 (0)