{"id":36971646,"url":"https://github.com/folded-php/view","last_synced_at":"2026-01-13T21:54:29.417Z","repository":{"id":62506147,"uuid":"293086000","full_name":"folded-php/view","owner":"folded-php","description":"View utilities for your PHP web app.","archived":false,"fork":false,"pushed_at":"2020-10-17T07:50:03.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-15T10:08:51.591Z","etag":null,"topics":["blade-template","laravel","php","view"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/folded/view","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/folded-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-05T13:55:52.000Z","updated_at":"2020-10-14T19:10:54.000Z","dependencies_parsed_at":"2022-11-02T12:31:14.348Z","dependency_job_id":null,"html_url":"https://github.com/folded-php/view","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/folded-php/view","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/folded-php","download_url":"https://codeload.github.com/folded-php/view/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/folded-php%2Fview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28401229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blade-template","laravel","php","view"],"created_at":"2026-01-13T21:54:27.374Z","updated_at":"2026-01-13T21:54:29.376Z","avatar_url":"https://github.com/folded-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folded/view\n\nView utilities for your PHP web app.\n\n[![Packagist License](https://img.shields.io/packagist/l/folded/view)](https://github.com/folded-php/view/blob/master/LICENSE) [![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/folded/view)](https://github.com/folded-php/view/blob/master/composer.json#L14) [![Packagist Version](https://img.shields.io/packagist/v/folded/view)](https://packagist.org/packages/folded/view) [![Build Status](https://travis-ci.com/folded-php/view.svg?branch=master)](https://travis-ci.com/folded-php/view) [![Maintainability](https://api.codeclimate.com/v1/badges/c3484b0de6fe6db59f18/maintainability)](https://codeclimate.com/github/folded-php/view/maintainability) [![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/folded-php/view)](https://www.tickgit.com/browse?repo=github.com/folded-php/view)\n\n## Summary\n\n- [About](#about)\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Examples](#examples)\n- [Version support](#version-support)\n\n## About\n\nI created this library to be able to pull it in an existing web app without too much effort setting it up.\n\nFolded is a constellation of packages to help you setting up a web app easily, using ready to plug in packages.\n\n- [folded/action](https://github.com/folded-php/action): A way to organize your controllers for your web app.\n- [folded/config](https://github.com/folded-php/config): Configuration utilities for your PHP web app.\n- [folded/crypt](https://github.com/folded-php/crypt): Encrypt and decrypt strings for your web app.\n- [folded/exception](https://github.com/folded-php/exception): Various kind of exception to throw for your web app.\n- [folded/history](https://github.com/folded-php/history): Manipulate the browser history for your web app.\n- [folded/http](https://github.com/folded-php/http): HTTP utilities for your web app.\n- [folded/orm](https://github.com/folded-php/orm): An ORM for you web app.\n- [folded/request](https://github.com/folded-php/request): Request utilities, including a request validator, for your PHP web app.\n- [folded/routing](https://github.com/folded-php/routing): Routing functions for your PHP web app.\n- [folded/session](https://github.com/folded-php/session): Session functions for your web app.\n\n## Features\n\n- Can render Blade views, and pass data to it\n- Can render plain PHP views\n- Can add data to a specific views beforehand (handy if you always need some data in your layouts for example)\n- Eager load the view engine such as it is not booted until you call `displayView()`\n\n## Requirements\n\n- PHP version \u003e= 7.4.0\n- Composer installed\n\n## Installation\n\n- [1. Install the package](#1-install-the-package)\n- [2. Set up the view engine](#2-set-up-the-view-engine)\n\n### 1. Install the package\n\nIn your root folder directory, run this command:\n\n```bash\ncomposer require folded/view\n```\n\n### 2. Set up the view engine\n\nIn the script that is called before displaying your view, add this set up code:\n\n```php\nuse function Folded\\setViewFolderPath;\nuse function Folded\\setViewCacheFolderPath;\n\nsetViewFolderPath(__DIR__ . \"/views\");\nsetViewCacheFolderPath(__DIR__ . \"/cache/views\");\n```\n\nThe 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.\n\n## Examples\n\nSince 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.\n\n- [1. Display a view](#1-display-a-view)\n- [2. Pass data to your view](#2-pass-data-to-your-view)\n- [3. Display a plain PHP view](#3-display-a-plain-php-view)\n- [4. Always pass certain data to a view](#4-always-pass-certain-data-to-a-view)\n- [5. Get the rendered view](#5-get-the-rendered-view)\n\n### 1. Display a view\n\nIn this example, we will display a Blade view.\n\n```php\nuse function Folded\\displayView;\n\ndisplayView(\"home.index\");\n```\n\nWith the following content inside `views/home/index.blade.php`:\n\n```html\n\u003ch1\u003eHello world\u003c/h1\u003e\n```\n\n### 2. Pass data to your view\n\nIn this example, we will pass a string to the view we display.\n\n```php\nuse function Folded\\displayView;\n\ndisplayView(\"home.index\", [\n  \"name\" =\u003e \"John\",\n]);\n```\n\nWith the following content inside the view:\n\n```html\n\u003ch1\u003eHello world\u003c/h1\u003e\n\n\u003cp\u003eWelcome to my website, {{ $name }}.\u003c/p\u003e\n```\n\n### 3. Display a plain PHP view\n\nIn this example, we will display a plain PHP file.\n\n```php\nuse function Folded\\displayView;\n\ndisplayView(\"about-us.index\");\n```\n\nThe plain PHP view is located at `views/about-us/index.php` (notice there is no \"blade\" extension now), with the following content:\n\n```html\n\u003ch1\u003eAbout us\u003c/h1\u003e\n```\n\n### 4. Always pass certain data to a view\n\nIn 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.\n\n```php\nuse function Folded\\addDataToView;\n\naddDataToView(\"layouts.base\", [\n  \"companyName\" =\u003e \"Folded\",\n]);\n```\n\n### 5. Get the rendered view\n\nIn this example, we will get the rendered view in a variable (useful to send emails for example).\n\n```php\nuse function Folded\\getRenderedView;\n\n$content = getRenderedView(\"emails.account-created\");\n```\n\n## Version support\n\n|        | 7.3 | 7.4 | 8.0 |\n| ------ | --- | --- | --- |\n| v0.1.0 | ❌  | ✔️  | ❓  |\n| v0.1.1 | ❌  | ✔️  | ❓  |\n| v0.1.2 | ❌  | ✔️  | ❓  |\n| v0.2.0 | ❌  | ✔️  | ❓  |\n| v0.2.1 | ❌  | ✔️  | ❓  |\n| v0.2.2 | ❌  | ✔️  | ❓  |\n| v0.2.3 | ❌  | ✔️  | ❓  |\n| v0.3.0 | ❌  | ✔️  | ❓  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffolded-php%2Fview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffolded-php%2Fview/lists"}