PHPackages                             statix/petals - 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. statix/petals

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

statix/petals
=============

A PHP templating engine based on Laravel Blade

11[3 PRs](https://github.com/statix-php/petals/pulls)PHP

Since May 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/statix-php/petals)[ Packagist](https://packagist.org/packages/statix/petals)[ RSS](/packages/statix-petals/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

A PHP templating engine based on Laravel Blade
==============================================

[](#a-php-templating-engine-based-on-laravel-blade)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e49b098563d0fe0d10c077f10a51f770ce4368785f617a1453658bba2f598057/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7374617469782f706574616c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/statix/petals)[![Tests](https://github.com/statix-php/petals/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/statix-php/petals/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/d0e4125d03a991f24a3895a9fa1595090ee78e7a56665fbd6235c4049ee6fbad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7374617469782f706574616c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/statix/petals)

[![Banner image](.github/banner.jpg)](.github/banner.jpg)

Petals is a zero dependency PHP templating engine based on Laravel Blade. This was built as a fun experiment to play with ChatGPT and GitHub Co-pilot, between the two AI tools they wrote ~60% of the code.

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

[](#installation)

You can install the package via composer:

```
composer require statix-php/petals
```

Usage
-----

[](#usage)

```
use Statix\Petals\TemplatingEngine;

// require the composer autoloader
require __DIR__.'/vendor/autoload.php';

$engine = new TemplatingEngine(
    templates: __DIR__.'/templates',
    cachePath: __DIR__.'/cache',
);

$engine = new TemplatingEngine(
    templates: [
        __DIR__ . '/templates-one',
        __DIR__ . '/templates-two',
    ],
    cachePath: __DIR__.'/cache',
);

// Render the templates/app.blade.php template
$content = $engine->render('app', [
    'message' => 'Hello world!',
]);

// Render the given string
$content = $engine->renderString('Hello {{ $name }}! The unix timestamp is {{ $time }}', [
    'name' => 'world',
    'time' => time(),
]);

// Compile the template to the cache directory, the compiled template will be used to render the template when render is called
$engine->compile('app');

// Compile the given string to the cache directory, if render is called on the same string, it will be rendered from the compiled cache template
$engine->compileString('Hello {{ $name }}! The unix timestamp is {{ $time }}');

// Clear the compiled templates
$engine->clearCache();
```

Testing
-------

[](#testing)

```
composer test
```

Formatting
----------

[](#formatting)

```
composer format
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Wyatt Castaneda](https://github.com/statix-php)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ec1f5d67a8ace8451f50303ed7fc9185a8298b9a38dc4d47c3aeb283255e66d?d=identicon)[wyattcast44](/maintainers/wyattcast44)

---

Top Contributors

[![WyattCast44](https://avatars.githubusercontent.com/u/17957937?v=4)](https://github.com/WyattCast44 "WyattCast44 (22 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

### Embed Badge

![Health badge](/badges/statix-petals/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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