{"id":20862387,"url":"https://github.com/lelyfoto/twig-instanceof","last_synced_at":"2026-05-02T14:01:32.040Z","repository":{"id":57013730,"uuid":"457994670","full_name":"lelyfoto/twig-instanceof","owner":"lelyfoto","description":"Adds InstanceOf Expression as Twig Extension","archived":false,"fork":false,"pushed_at":"2024-05-21T14:30:06.000Z","size":12,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-15T16:14:16.595Z","etag":null,"topics":["bundle","instanceof","php","symfony","symfony-bundle","twig"],"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/lelyfoto.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-11T00:37:05.000Z","updated_at":"2025-10-17T11:59:50.000Z","dependencies_parsed_at":"2024-01-02T10:27:37.714Z","dependency_job_id":"5b3c8524-920e-4e2e-b5bf-e8264943adb0","html_url":"https://github.com/lelyfoto/twig-instanceof","commit_stats":{"total_commits":4,"total_committers":3,"mean_commits":"1.3333333333333333","dds":0.5,"last_synced_commit":"dd7205d4b1422167c791037a3a86e9baf9b1e5f7"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lelyfoto/twig-instanceof","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelyfoto%2Ftwig-instanceof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelyfoto%2Ftwig-instanceof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelyfoto%2Ftwig-instanceof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelyfoto%2Ftwig-instanceof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lelyfoto","download_url":"https://codeload.github.com/lelyfoto/twig-instanceof/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelyfoto%2Ftwig-instanceof/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"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":["bundle","instanceof","php","symfony","symfony-bundle","twig"],"created_at":"2024-11-18T05:21:20.800Z","updated_at":"2026-05-02T14:01:32.021Z","avatar_url":"https://github.com/lelyfoto.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twig InstanceOf Expression\n\n[![Package version](https://img.shields.io/packagist/v/lelyfoto/twig-instanceof.svg?style=flat-square)](https://packagist.org/packages/lelyfoto/twig-instanceof)\n[![PHP version](https://img.shields.io/packagist/php-v/lelyfoto/twig-instanceof.svg?style=flat-square)](https://packagist.org/packages/lelyfoto/twig-instanceof)\n[![License](https://img.shields.io/packagist/l/lelyfoto/twig-instanceof.svg?style=flat-square)](LICENSE)\n\nAdds InstanceOf Expression as Twig Extension.\nWhen you want to check for a specific type of variable in a twig template.\n\n## Prerequisites\n- PHP 8.0+\n- Symfony 5.4, 6.x, 7.x or 8.x\n- Twig 3.x\n\n## Installation\n1. Install this Symfony bundle with composer:\n    ```bash\n    composer require lelyfoto/twig-instanceof\n    ```\n2. Make sure the bundle is added to `config/bundles.php`:\n    ```\n    return [\n        // ...\n        Lelyfoto\\Twig\\InstanceOf\\TwigInstanceOfBundle::class =\u003e ['all' =\u003e true],\n        // ...\n    ];   \n    ```\n\n## Usage\nImportant to note that when testing for a class that you must use quotes and escaping inside the twig templates.   \n\n```twig\n{% if testObject is instanceof('\\\\Example\\\\TestInterface') %}\n    Do something with {{ testObject.show() }}\n{% endif %}\n```\n\n## Use without Symfony\n\n```php\nuse Twig\\Environment;\nuse Lelyfoto\\Twig\\InstanceOf\\InstanceOfExtension;\n\n$twig = new Environment($loader);\n$twig-\u003eaddExtension(new InstanceOfExtension());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelyfoto%2Ftwig-instanceof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flelyfoto%2Ftwig-instanceof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelyfoto%2Ftwig-instanceof/lists"}