{"id":21000398,"url":"https://github.com/statix-php/petals","last_synced_at":"2025-07-31T02:11:05.551Z","repository":{"id":64520898,"uuid":"576390031","full_name":"statix-php/petals","owner":"statix-php","description":"A PHP templating engine based on Laravel Blade","archived":false,"fork":false,"pushed_at":"2023-10-09T13:35:59.000Z","size":98,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T00:02:03.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/statix-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"statix-php"}},"created_at":"2022-12-09T18:25:49.000Z","updated_at":"2022-12-09T20:29:09.000Z","dependencies_parsed_at":"2025-01-20T09:40:21.568Z","dependency_job_id":"fecfcc5f-0513-482d-8fab-dfc46ca939a4","html_url":"https://github.com/statix-php/petals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"spatie/package-skeleton-php","purl":"pkg:github/statix-php/petals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Fpetals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Fpetals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Fpetals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Fpetals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/statix-php","download_url":"https://codeload.github.com/statix-php/petals/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/statix-php%2Fpetals/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261212280,"owners_count":23125576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-19T08:10:16.669Z","updated_at":"2025-06-22T00:02:38.364Z","avatar_url":"https://github.com/statix-php.png","language":"PHP","readme":"# A PHP templating engine based on Laravel Blade\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/statix/petals.svg?style=flat-square)](https://packagist.org/packages/statix/petals)\n[![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)\n[![Total Downloads](https://img.shields.io/packagist/dt/statix/petals.svg?style=flat-square)](https://packagist.org/packages/statix/petals)\n\n![Banner image](.github/banner.jpg)\n\nPetals 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.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require statix-php/petals\n```\n\n## Usage\n\n```php\nuse Statix\\Petals\\TemplatingEngine;\n\n// require the composer autoloader\nrequire __DIR__.'/vendor/autoload.php';\n\n$engine = new TemplatingEngine(\n    templates: __DIR__.'/templates',\n    cachePath: __DIR__.'/cache',\n);\n\n$engine = new TemplatingEngine(\n    templates: [\n        __DIR__ . '/templates-one',\n        __DIR__ . '/templates-two',\n    ],\n    cachePath: __DIR__.'/cache',\n);\n\n// Render the templates/app.blade.php template\n$content = $engine-\u003erender('app', [\n    'message' =\u003e 'Hello world!',\n]);\n\n// Render the given string\n$content = $engine-\u003erenderString('Hello {{ $name }}! The unix timestamp is {{ $time }}', [\n    'name' =\u003e 'world',\n    'time' =\u003e time(),\n]);\n\n// Compile the template to the cache directory, the compiled template will be used to render the template when render is called\n$engine-\u003ecompile('app');\n\n// 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\n$engine-\u003ecompileString('Hello {{ $name }}! The unix timestamp is {{ $time }}');\n\n// Clear the compiled templates\n$engine-\u003eclearCache();\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Formatting\n\n```bash\ncomposer format\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Credits\n\n- [Wyatt Castaneda](https://github.com/statix-php)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://github.com/sponsors/statix-php"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatix-php%2Fpetals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstatix-php%2Fpetals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstatix-php%2Fpetals/lists"}