{"id":36997636,"url":"https://github.com/splashsky/modello","last_synced_at":"2026-01-13T23:55:36.975Z","repository":{"id":48478508,"uuid":"98186955","full_name":"splashsky/modello","owner":"splashsky","description":"A super-simple, super-lightweight templating engine for PHP","archived":false,"fork":false,"pushed_at":"2023-04-30T00:31:32.000Z","size":11208,"stargazers_count":15,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-10T23:34:25.188Z","etag":null,"topics":["compiler","formatter","lightweight-template-engine","lightweight-templating-engine","modello","php","template","template-engine"],"latest_commit_sha":null,"homepage":"","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/splashsky.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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":"2017-07-24T12:12:22.000Z","updated_at":"2024-10-28T07:47:02.000Z","dependencies_parsed_at":"2022-08-24T14:39:05.935Z","dependency_job_id":null,"html_url":"https://github.com/splashsky/modello","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/splashsky/modello","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splashsky%2Fmodello","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splashsky%2Fmodello/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splashsky%2Fmodello/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splashsky%2Fmodello/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splashsky","download_url":"https://codeload.github.com/splashsky/modello/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splashsky%2Fmodello/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["compiler","formatter","lightweight-template-engine","lightweight-templating-engine","modello","php","template","template-engine"],"created_at":"2026-01-13T23:55:36.542Z","updated_at":"2026-01-13T23:55:36.965Z","avatar_url":"https://github.com/splashsky.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.imgur.com/xZKsXPi.jpg\" width=\"600\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/splashsky/modello?style=for-the-badge\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/made%20with-php-blueviolet?style=for-the-badge\"\u003e\n\u003c/p\u003e\n\n# Modello - simple, lightweight template compiler\n\n**Modello** is a super-simple, super-lightweight templating engine written in PHP. It's purpose is to be a standalone class that can be included in any project and used to quickly and efficiently parse/compile a template.\n\n## Contributing\nWhile I don't intend for this to become a replacement for other templating solutions, I felt it would be fun to make a simple little compiler for small projects. The goal is ease of use and compactness, and hopefully my work reflects that.\n\nIf you have ideas, or want to contribute some code, feel more than welcome to open an Issue or a Pull Request. Thanks for dropping by!\n\n## Getting Started\nThe easiest way of using Modello in your project is Composer.\n```shell\ncomposer require splashsky/modello\n```\n\nOtherwise, you can download the `.zip` or clone the project using Git. After that, move the `Modello.php` class file to wherever you want!\n\n## How do I start up the compiler?\nModello is easy to get started with.\n\n```php\n// require() and/or 'use' Modello, depending on your environment\n$modello = new Modello('path/to/views', 'path/to/cache');\n```\n\nThe first argument for the constructor tells Modello where your template directory is, and this will be the root from which Modello looks for template files. The second argument tells Modello where to create the compiled views.\n\n`$modello-\u003esetViews(string $viewPath)` and `$modello-\u003esetCache(string $cachePath)` are available to change the views and cache directories at runtime.\n\nUsing `$modello-\u003esetExtension(string $extension)` allows you to change the extension Modello looks for on template files - by default this is `.mllo.php`.\n\nYou can use `$modello-\u003esetCacheEnabled(bool $enabled)` to enable or disable caching - disabled means that Modello will re-compile the view on every render.\n\n## How do I compile a template?\nSimply call `$modello-\u003eview()`!\n\n```php\n/**\n * File Directory\n * | cache/views/\n *   example.php (will be created at render)\n * | views/\n *   example.mllo.php\n*/\n\necho $modello-\u003eview('example', ['foo' =\u003e 'bar']);\n```\n\nWhen telling Modello what template to render, ensure you're not adding the extension - only use the name of the template. Modello will use whatever extension it has set when it looks for your file. You can use dot notation as well, so 'foo.bar' is as valid as 'foo/bar'.\n\nThe second argument in the `view()` function is your data array - these `key =\u003e value` pairs will be extracted into the resulting template.\n\nWhen a template is compiled for the first time - or if Modello detects the original template file has changed - it will generate a newly compiled version of the template and store it in the cached directory for faster subsequent renders.\n\n## What syntax can I use in the template?\nModello uses template syntax very similar (basically identical) to Laravel Blade. Here's the directives it currently supports:\n\n```\n// This is the echo syntax\n{{ $foo }}\n{{ bar() }}\n\n// This is the if-else syntax\n@if(condition)\n    // ...\n@elseif(condition)\n    // ...\n@else\n    // ...\n@endif\n\n// This is the foreach syntax\n@foreach($array as $key =\u003e $value)\n    {{ $key }} equals {{ $value }}\n@endforeach\n\n// This is a comment\n{{-- I won't show up in the HTML or in the compiled template file! --}}\n\n// This is the almighty include directive!\n@include('path.to.template')\n\n// We also support blocks and yielding\n@block('foo')\n    something here\n@endblock\n\n@yield('foo') // Outputs: something here\n\n// Add block conditionals\n@hasblock('foo')\nif block foo exists, this will be output!\n@endif\n\n@blockmissing('bar')\nif the bar block doesn't exist, this will be put out!\n@endif\n```\n\nAs long as the data you provide the directives is valid PHP, it will work!\n\nFor the include directive, it will look for the template you specify relative to the template directory you gave to Modello. If it cannot find the template you specify, it will return \"path/to/template.php could not be found\", which will show up in your HTML.\n\n## What if I just need to parse?\nModello still has the classic parsing functionality from before - in the static method `parse()`.\n\n```php\necho Modello::parse('Hello, {{ name }}!', ['name' =\u003e 'Jerry']);\n```\n\nOf course, you won't have access to any of the directives or other features of a compiled template.\n\n## License\nModello is completely free, open source software. It's covered under the MIT license, and you can read the details in the [license.md](license.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplashsky%2Fmodello","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplashsky%2Fmodello","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplashsky%2Fmodello/lists"}