{"id":33987985,"url":"https://github.com/xtompie/tpl","last_synced_at":"2026-03-17T20:14:45.274Z","repository":{"id":255905794,"uuid":"853740244","full_name":"xtompie/tpl","owner":"xtompie","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-09T19:53:32.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T17:57:23.764Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtompie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-09-07T12:03:21.000Z","updated_at":"2025-07-09T19:53:35.000Z","dependencies_parsed_at":"2024-09-07T19:43:41.010Z","dependency_job_id":"fea5896e-022a-45ae-b0d9-115a2e2003b7","html_url":"https://github.com/xtompie/tpl","commit_stats":null,"previous_names":["xtompie/tpl"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xtompie/tpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtompie%2Ftpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtompie%2Ftpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtompie%2Ftpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtompie%2Ftpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtompie","download_url":"https://codeload.github.com/xtompie/tpl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtompie%2Ftpl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30630356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","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":[],"created_at":"2025-12-13T05:46:34.833Z","updated_at":"2026-03-17T20:14:45.268Z","avatar_url":"https://github.com/xtompie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tpl\n\nTpl native PHP template system.\n\nSimple, lightweight, no dependencies, low abstraction, low features, easy to extend.\n\n```php\n\u003c?php\n\nuse Xtompie\\Tpl\\Tpl;\n\n$tpl = new Tpl();\necho $tpl-\u003e__invoke('page.tpl.php', ['title' =\u003e 'Foobar']);\n```\n\n`page.tpl.php`:\n\n```phtml\n\u003c?php /** @var Xtompie\\Tpl\\Tpl $this */ ?\u003e\n\n\u003ch1\u003e\u003c?= $this-\u003ee($title) ?\u003e\u003c/h1\u003e\n```\n\n- uses native PHP\n- not auto escape, but `vendor/bin/xtompie-tpl-audit.sh -p src -s .tpl.php` can be used\n- no sections\n- no blocks\n- no namespaces\n- autocompletion using `\u003c?php /** @var Xtompie\\Tpl\\Tpl $this */ ?\u003e`\n\n## Requiments\n\nPHP \u003e= 8.0\n\n## Installation\n\nUsing [composer](https://getcomposer.org/)\n\n```shell\ncomposer require xtompie/tpl\n```\n\n## Full feature example\n\n```phtml\n\n// Extend Tpl for customization, set templatePathPrefix, add helpers\n// src/App/Shared/Tpl/Tpl.php\n\nnamespace App\\Shared\\Tpl\\Tpl;\n\nuse Xtompie\\Tpl\\Tpl as BaseTpl;\n\nclass Tpl extends BaseTpl\n{\n    protected function templatePathPrefix(): string\n    {\n        return 'src/';\n    }\n\n    protected function date(int $time): string\n    {\n        return $this-\u003ee(date('Y-m-d H:i:s', $time));\n    }\n}\n\n// src/App/Test/Ui/Controller/TestController.php\n\nnamespace App\\Test\\Ui\\Controller;\n\nuse App\\Shared\\Tpl\\Tpl;\n\nclass TestController\n{\n    public function __construct(\n        private Tpl $tpl\n    ) {\n    }\n\n    public function __invoke(): string\n    {\n        return $this-\u003etpl-\u003e__invoke('Test/UI/Tpl/content.tpl.php', ['title' =\u003e 'foobar']);\n    }\n}\n\n// src/Test/UI/Tpl/content.tpl.php - first level\n// keep template file names with `.tpl.php` suffix e.g. easy exclude from phpstan\n\u003c?php /** @var App\\Shared\\Tpl\\Tpl $this */ ?\u003e\n\u003c?php $this-\u003epush('Test/UI/Tpl/layout.tpl.php', ['title' =\u003e $title]); ?\u003e\n\u003ch1\u003e\u003c?= $this-\u003ee($title) ?\u003e\u003c/h1\u003e\n\n// src/Test/UI/Tpl/layout.tpl.php - second level\n\u003c?php /** @var App\\Shared\\Tpl\\Tpl $this */ ?\u003e\n\u003c?php $this-\u003epush('Test/UI/Tpl/head.tpl.php', ['title' =\u003e $title]); ?\u003e\n\u003cdiv class=\"container\"\u003e\n    \u003c?= $this-\u003erender('Test/UI/Tpl/navbar.tpl.php') ?\u003e\n    \u003c?= $this-\u003econtent() ?\u003e\n\u003c/div\u003e\n\n// src/Test/UI/Tpl/navbar.tpl.php\n\u003cnav\u003e\n    \u003ca href=\"/\"\u003eIndex\u003c/a\u003e\n\u003c/nav\u003e\n\n// src/Test/UI/Tpl/head.tpl.php - third level\n\u003c?php /** @var App\\Shared\\Tpl\\Tpl $this */ ?\u003e\n\u003chtml\u003e\n    \u003chead\u003e\n        \u003ctitle\u003e\u003c?= $this-\u003ee($title) ?\u003e\u003c/title\u003e\n    \u003c/head\u003e\n    \u003cbody\u003e\n        \u003c?= $this-\u003econtent() ?\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtompie%2Ftpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtompie%2Ftpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtompie%2Ftpl/lists"}