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
Copy file name to clipboardExpand all lines: docs/1-essentials/02-views.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -622,26 +622,9 @@ Tempest views are always compiled to plain PHP code before being rendered. Durin
622
622
623
623
During deployments, that cache must be cleared in order to not serve outdated views to users. You may do that by running `tempest view:clear` on every deploy.
624
624
625
-
## Separate view directories
626
-
627
-
View files can live in any directory that is discoverable by Tempest. That means: a directory with a PSR-4 namespace associated with it. If you want your view files to live outside of `src` or `app`, you can add a namespace for it in composer.json:
628
-
629
-
```json composer.json
630
-
"autoload": {
631
-
"psr-4": {
632
-
"App\\": "src/",
633
-
"Views\\": "views/"
634
-
},
635
-
}
636
-
```
637
-
638
-
Don't forget to run `composer up` after making changes to your composer.json file.
639
-
640
-
Note that view files themselves don't need a namespace; this namespace is only here to tell Tempest that `views/` is a directory it should scan. If you want to add a class in the `Views` namespace (like, for example, a [custom view object](/2.x/essentials/views#using-dedicated-view-objects)), then that is possible as well.
641
-
642
625
## Tempest View as a standalone engine
643
626
644
-
Tempest View is also designed to be used as a standalone engine in whatever PHP project you want. Start by requiring `tempest/view`:
627
+
Tempest View is also designed to be used as a standalone engine in whatever PHP project you want. Start by requiring `tempest/view`:
It's recommended to turn view caching on in production environments. To clear the view cache, you'll have to manually delete the cache directory, which is located at `./vendor/tempest/view/.tempest/cache`.
702
685
686
+
## Separate view directories
687
+
688
+
View files can live in any directory that is discoverable by Tempest. That means: a directory with a PSR-4 namespace associated with it. If you want your view files to live outside of `src` or `app`, you can add a namespace for it in composer.json:
689
+
690
+
```json composer.json
691
+
"autoload": {
692
+
"psr-4": {
693
+
"App\\": "src/",
694
+
"Views\\": "views/"
695
+
},
696
+
}
697
+
```
698
+
699
+
Don't forget to run `composer up` after making changes to your composer.json file.
700
+
701
+
Note that view files themselves don't need a namespace; this namespace is only here to tell Tempest that `views/` is a directory it should scan. If you want to add a class in the `Views` namespace (like, for example, a [custom view object](/2.x/essentials/views#using-dedicated-view-objects)), then that is possible as well.
702
+
703
703
## Using other engines
704
704
705
705
While Tempest View is simple to use, it currently lacks tooling support from editors and IDEs. You may also simply prefer other templating engines. For these reasons, you may use any other engine of your choice.
0 commit comments