PHPackages                             opensolutions/foil - 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. opensolutions/foil

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

opensolutions/foil
==================

PHP template engine for native PHP templates

0.7.4(8mo ago)1945—0%1MITPHPPHP &gt;=8.1

Since Jan 21Pushed 8mo agoCompare

[ Source](https://github.com/opensolutions/foil)[ Packagist](https://packagist.org/packages/opensolutions/foil)[ Docs](https://github.com/opensolutions/foil)[ RSS](/packages/opensolutions-foil/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (27)Used By (1)

FOIL
====

[](#foil)

> PHP template engine, for PHP templates.

---

[![license](https://camo.githubusercontent.com/9336836ce504a3574dc4245e4421ce5f22d54e1101463771b9cb1061da9c0cc7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666f696c2f666f696c2e7376673f7374796c653d666c61742d737175617265)](http://opensource.org/licenses/MIT)

---

Cloned from the abandoned [FoilPHP/Foil](https://github.com/FoilPHP/Foil) in August 2025.

---

**Foil** brings all the flexibility and power of modern template engines to native PHP templates. Write simple, clean and concise templates with nothing more than PHP.

Key Features
============

[](#key-features)

- Templates inheritance (you'll never miss Twig or Blade)
- Clean, concise and DRY templates
- Dozen of ready-made helper functions and filters
- Easily extensible and customizable
- Multiple template folders with file auto-discover or custom picking
- Auto or manual data escape
- Powerful context API (preassign data to templates using conditions)
- Framework agnostic, centralized API for very easy integration
- Composer ready, fully unit and functional tested, PSR-1/2/4 compliant

...and many more

Why?
====

[](#why)

Templates engines like Twig, or Blade are a great thing, really.

However, to use them one needs to learn another *language* with its own syntax and rules.

Moreover, using compiled engines to use even a simple PHP function one needs to write engine extension.

On its side, PHP is already a templating language, but honestly it's not a good one, because it's missing pivotal features of modern template engines, like template inheritance.

---

Requirements
============

[](#requirements)

Foil is framework agnostic, only thing needed is PHP 5.4+ and Composer to add Foil to you PHP project.

---

License
=======

[](#license)

Foil is open source and released under MIT license. See LICENSE file for more info.

Question? Issues?
=================

[](#question-issues)

Foil is hosted on GitHub. Feel free to open issues there for suggestions, questions and real issues.

Who's Behind Foil
=================

[](#whos-behind-foil)

I'm Giuseppe, I deal with PHP since 2005. For questions, rants or chat ping me on Twitter ([@gmazzap](https://twitter.com/gmazzap)) or on ["The Loop"](http://chat.stackexchange.com/rooms/6/the-loop) (Stack Exchange) chat. Well, it's possible I'll ignore rants.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance58

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 92.1% 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 ~168 days

Recently: every ~4 days

Total

24

Last Release

267d ago

PHP version history (2 changes)0.1.2PHP &gt;=5.4

0.7.2PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/804649?v=4)[Barry O'Donovan](/maintainers/barryo)[@barryo](https://github.com/barryo)

---

Top Contributors

[![gmazzap](https://avatars.githubusercontent.com/u/2208282?v=4)](https://github.com/gmazzap "gmazzap (187 commits)")[![barryo](https://avatars.githubusercontent.com/u/804649?v=4)](https://github.com/barryo "barryo (7 commits)")[![kraftner](https://avatars.githubusercontent.com/u/2428517?v=4)](https://github.com/kraftner "kraftner (4 commits)")[![thevikas](https://avatars.githubusercontent.com/u/94922?v=4)](https://github.com/thevikas "thevikas (1 commits)")[![avant1](https://avatars.githubusercontent.com/u/2902785?v=4)](https://github.com/avant1 "avant1 (1 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (1 commits)")[![brad-jones](https://avatars.githubusercontent.com/u/2754772?v=4)](https://github.com/brad-jones "brad-jones (1 commits)")[![fbraem](https://avatars.githubusercontent.com/u/2566642?v=4)](https://github.com/fbraem "fbraem (1 commits)")

---

Tags

templatestemplate engine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opensolutions-foil/health.svg)

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

###  Alternatives

[foil/foil

PHP template engine for native PHP templates

170111.2k7](/packages/foil-foil)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k5.9M232](/packages/league-plates)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)[infyomlabs/adminlte-templates

AdminLTE templates for InfyOm Laravel Generator

2681.6M7](/packages/infyomlabs-adminlte-templates)[phptal/phptal

PHPTAL is a templating engine for PHP5 that implements Zope Page Templates syntax

179421.6k19](/packages/phptal-phptal)[gamajo/template-loader

A class for your WordPress plugin, to allow loading template parts with fallback through the child theme &gt; parent theme &gt; plugin

29647.0k5](/packages/gamajo-template-loader)

PHPackages © 2026

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