PHPackages                             folded/view - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. folded/view

ActiveLibrary[Templating &amp; Views](/categories/templating)

folded/view
===========

View utilities for your PHP web app.

v0.3.0(5y ago)014MITPHPPHP &gt;=7.4.0

Since Sep 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/folded-php/view)[ Packagist](https://packagist.org/packages/folded/view)[ RSS](/packages/folded-view/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (3)Versions (9)Used By (0)

folded/view
===========

[](#foldedview)

View utilities for your PHP web app.

[![Packagist License](https://camo.githubusercontent.com/4ba295b0abe9b0f01823d061d35dcce82bd9c37fddd325b9bff5fcc9762da08e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666f6c6465642f76696577)](https://github.com/folded-php/view/blob/master/LICENSE) [![Packagist PHP Version Support](https://camo.githubusercontent.com/6a02f5b89d94875781d9d5305dba6c0683ed9e6ebc9f8e7b295162ac69598bed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f666f6c6465642f76696577)](https://github.com/folded-php/view/blob/master/composer.json#L14) [![Packagist Version](https://camo.githubusercontent.com/7a2d453c739cb791cba5ee13b7507534f46387a7cfdde7e60cbd0edbfebc7786/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f6c6465642f76696577)](https://packagist.org/packages/folded/view) [![Build Status](https://camo.githubusercontent.com/c0c8bf9de4c15023a9a2bdd201320856d3df926a39767643ba23369efde5195c/68747470733a2f2f7472617669732d63692e636f6d2f666f6c6465642d7068702f766965772e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/folded-php/view) [![Maintainability](https://camo.githubusercontent.com/9061e0faa81f62e80dca599d107541898259753440c16a716ccd5e626b9a9f47/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f63333438346230646536666536646235396631382f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/folded-php/view/maintainability) [![TODOs](https://camo.githubusercontent.com/3f39afe75e2bebd09064c794ad8b66e44b2d03af4ea3abc316ac3644ed5d517e/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f6170692e7469636b6769742e636f6d2f62616467653f7265706f3d6769746875622e636f6d2f666f6c6465642d7068702f76696577)](https://www.tickgit.com/browse?repo=github.com/folded-php/view)

Summary
-------

[](#summary)

- [About](#about)
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Examples](#examples)
- [Version support](#version-support)

About
-----

[](#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](https://github.com/folded-php/action): A way to organize your controllers for your web app.
- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.
- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.
- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.
- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.
- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.
- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.
- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.
- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.
- [folded/session](https://github.com/folded-php/session): Session functions for your web app.

Features
--------

[](#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
------------

[](#requirements)

- PHP version &gt;= 7.4.0
- Composer installed

Installation
------------

[](#installation)

- [1. Install the package](#1-install-the-package)
- [2. Set up the view engine](#2-set-up-the-view-engine)

### 1. Install the package

[](#1-install-the-package)

In your root folder directory, run this command:

```
composer require folded/view
```

### 2. Set up the view engine

[](#2-set-up-the-view-engine)

In the script that is called before displaying your view, add this set up code:

```
use function Folded\setViewFolderPath;
use function Folded\setViewCacheFolderPath;

setViewFolderPath(__DIR__ . "/views");
setViewCacheFolderPath(__DIR__ . "/cache/views");
```

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
--------

[](#examples)

Since this library relies on Laravel's [illuminate/view](https://github.com/illuminate/view), you can refer to [the 7.X documentation](https://laravel.com/docs/7.x/blade) if you need any information regarding the Blade syntax and the available Blade directives.

- [1. Display a view](#1-display-a-view)
- [2. Pass data to your view](#2-pass-data-to-your-view)
- [3. Display a plain PHP view](#3-display-a-plain-php-view)
- [4. Always pass certain data to a view](#4-always-pass-certain-data-to-a-view)
- [5. Get the rendered view](#5-get-the-rendered-view)

### 1. Display a view

[](#1-display-a-view)

In this example, we will display a Blade view.

```
use function Folded\displayView;

displayView("home.index");
```

With the following content inside `views/home/index.blade.php`:

```
Hello world
```

### 2. Pass data to your view

[](#2-pass-data-to-your-view)

In this example, we will pass a string to the view we display.

```
use function Folded\displayView;

displayView("home.index", [
  "name" => "John",
]);
```

With the following content inside the view:

```
Hello world

Welcome to my website, {{ $name }}.
```

### 3. Display a plain PHP view

[](#3-display-a-plain-php-view)

In this example, we will display a plain PHP file.

```
use function Folded\displayView;

displayView("about-us.index");
```

The plain PHP view is located at `views/about-us/index.php` (notice there is no "blade" extension now), with the following content:

```
About us
```

### 4. Always pass certain data to a view

[](#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.

```
use function Folded\addDataToView;

addDataToView("layouts.base", [
  "companyName" => "Folded",
]);
```

### 5. Get the rendered view

[](#5-get-the-rendered-view)

In this example, we will get the rendered view in a variable (useful to send emails for example).

```
use function Folded\getRenderedView;

$content = getRenderedView("emails.account-created");
```

Version support
---------------

[](#version-support)

7.37.48.0v0.1.0❌✔️❓v0.1.1❌✔️❓v0.1.2❌✔️❓v0.2.0❌✔️❓v0.2.1❌✔️❓v0.2.2❌✔️❓v0.2.3❌✔️❓v0.3.0❌✔️❓

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

8

Last Release

2041d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15908747?v=4)[Anwar](/maintainers/khalyomede)[@khalyomede](https://github.com/khalyomede)

---

Top Contributors

[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (43 commits)")

---

Tags

blade-templatelaravelphpview

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/folded-view/health.svg)

```
[![Health](https://phpackages.com/badges/folded-view/health.svg)](https://phpackages.com/packages/folded-view)
```

###  Alternatives

[blade-ui-kit/blade-icons

A package to easily make use of icons in your Laravel Blade views.

2.5k34.2M309](/packages/blade-ui-kit-blade-icons)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[livewire/blaze

A tool for optimizing Blade component performance by folding them into parent templates

688221.3k17](/packages/livewire-blaze)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
