{"id":31577419,"url":"https://github.com/beastbytes/latte-use-extension","last_synced_at":"2026-03-09T02:32:16.520Z","repository":{"id":297686500,"uuid":"997547410","full_name":"beastbytes/latte-use-extension","owner":"beastbytes","description":"A Latte template engine extension that emulates the PHP use operator","archived":false,"fork":false,"pushed_at":"2025-12-07T15:43:29.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-21T20:21:53.398Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beastbytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2025-06-06T18:04:53.000Z","updated_at":"2025-12-07T15:43:32.000Z","dependencies_parsed_at":"2025-06-06T21:15:25.049Z","dependency_job_id":null,"html_url":"https://github.com/beastbytes/latte-use-extension","commit_stats":null,"previous_names":["beastbytes/latte-use-extension"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beastbytes/latte-use-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Flatte-use-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Flatte-use-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Flatte-use-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Flatte-use-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beastbytes","download_url":"https://codeload.github.com/beastbytes/latte-use-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Flatte-use-extension/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30280854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:23:26.802Z","status":"ssl_error","status_checked_at":"2026-03-09T02:22:46.175Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2025-10-05T18:23:26.540Z","updated_at":"2026-03-09T02:32:16.512Z","avatar_url":"https://github.com/beastbytes.png","language":"PHP","readme":"This package is a [Latte](https://latte.nette.org/) template engine extension that emulates\n[PHP's `use` operator](https://www.php.net/manual/en/language.namespaces.importing.php) \nand allows writing cleaner templates.\n\nBy default, Latte templates require the use of Fully Qualified CLass Names (FQCN); this can lead to cluttered templates.\nThe extension defines the `{use}` tag that allows templates to define the FQCN and optionally an alias,\nand refer to the _used_ class by the alias if defined, or the base class name if not.\n\n## Requirements\n- PHP 8.1 or higher.\n- Latte\n\n## Installation\nInstall the package using [Composer](https://getcomposer.org):\n\nEither:\n```shell\ncomposer require beastbytes/latte-use-extension\n```\nor add the following to the `require` section of your `composer.json`\n```json\n\"beastbytes/latte-use-extension\": \"\u003cversion.constraint\u003e\"\n```\n\n## Configuration\nThe extension is added to the Latte Engine using the engine's `addExtension()` method.\n```php\n$engine = new Engine();\n$engine-\u003eaddExtension(new UseExtension());\n```\n\n## Usage\nThe FQCN must be defined in a `{use}` tag before the base class name or alias is referenced in the template.\nThe best way to ensure this is to place `{use}` tags as near to the start of the template as possible.\n\nThe extension replaces the alias or base class name defined in the `use` tag with the FQCN in class instantation (`new`)\nstatements and class constants during compilation; it _does not_ import or alias the class.\n\n#### Differences from PHP\n* Group `use` definitions are _not_ supported.\n\n#### {use} Tag\n```latte\n{use Framework\\Module\\NamespacedClass}\n\n\u003cp\u003eThe value is {(new NamespacedClass)-\u003egetValue()}\u003c/p\u003e\n\u003cp\u003eThe constant is {NamespacedClass::CONSTANT}\u003c/p\u003e\n```\n\n#### {use} Tag with Alias\n```latte\n{use Framework\\Module\\Aliased\\NamespacedClass as AliasedClass}\n\n\u003cp\u003eThe value is {(new AliasedClass)-\u003egetValue()}\u003c/p\u003e\n\u003cp\u003eThe constant is {AliasedClass::CONSTANT}\u003c/p\u003e\n```\n\n#### Multiple {use} Tags\n```latte\n{use Framework\\Module\\Aliased\\NamespacedClass as AliasedClass}\n{use Framework\\Module\\NamespacedClass}\n\n{varType int $arg}\n{varType string $testString}\n\n\u003cp\u003eThe value is {(new NamespacedClass($arg))-\u003egetValue()}\u003c/p\u003e\n\u003cp\u003eThe constant is {NamespacedClass::CONSTANT}\u003c/p\u003e\n\u003cp\u003e{$testString|replace: AliasedClass::CONSTANT}\u003c/p\u003e\n```\n\n## License\nThe BeastBytes Latte Use Extension is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Flatte-use-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeastbytes%2Flatte-use-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Flatte-use-extension/lists"}