Download the PHP package folded/view without Composer
On this page you can find all versions of the php package folded/view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package view
folded/view
View utilities for your PHP web app.
Summary
- About
- Features
- Requirements
- Installation
- Examples
- Version support
About
I created this library to be able to pull it in an existing web app without too much effort setting it up.
Folded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.
- folded/action: A way to organize your controllers for your web app.
- folded/config: Configuration utilities for your PHP web app.
- folded/crypt: Encrypt and decrypt strings for your web app.
- folded/exception: Various kind of exception to throw for your web app.
- folded/history: Manipulate the browser history for your web app.
- folded/http: HTTP utilities for your web app.
- folded/orm: An ORM for you web app.
- folded/request: Request utilities, including a request validator, for your PHP web app.
- folded/routing: Routing functions for your PHP web app.
- folded/session: Session functions for your web app.
Features
- Can render Blade views, and pass data to it
- Can render plain PHP views
- Can add data to a specific views beforehand (handy if you always need some data in your layouts for example)
- Eager load the view engine such as it is not booted until you call
displayView()
Requirements
- PHP version >= 7.4.0
- Composer installed
Installation
- 1. Install the package
- 2. Set up the view engine
1. Install the package
In your root folder directory, run this command:
2. Set up the view engine
In the script that is called before displaying your view, add this set up code:
The cache is a place where your code is compiled to plain PHP, and stored in the disk, for faster rendering for next requests displaying the view.
Examples
Since this library relies on Laravel's illuminate/view, you can refer to the 7.X documentation if you need any information regarding the Blade syntax and the available Blade directives.
- 1. Display a view
- 2. Pass data to your view
- 3. Display a plain PHP view
- 4. Always pass certain data to a view
- 5. Get the rendered view
1. Display a view
In this example, we will display a Blade view.
With the following content inside views/home/index.blade.php
:
2. Pass data to your view
In this example, we will pass a string to the view we display.
With the following content inside the view:
3. Display a plain PHP view
In this example, we will display a plain PHP file.
The plain PHP view is located at views/about-us/index.php
(notice there is no "blade" extension now), with the following content:
4. Always pass certain data to a view
In this example, we will pass a company name to a layout view, to be able to not add it to every view that extends the layout.
5. Get the rendered view
In this example, we will get the rendered view in a variable (useful to send emails for example).
Version support
7.3 | 7.4 | 8.0 | |
---|---|---|---|
v0.1.0 | ❌ | ✔️ | ❓ |
v0.1.1 | ❌ | ✔️ | ❓ |
v0.1.2 | ❌ | ✔️ | ❓ |
v0.2.0 | ❌ | ✔️ | ❓ |
v0.2.1 | ❌ | ✔️ | ❓ |
v0.2.2 | ❌ | ✔️ | ❓ |
v0.2.3 | ❌ | ✔️ | ❓ |
v0.3.0 | ❌ | ✔️ | ❓ |