{"id":37235991,"url":"https://github.com/gglnx/twig-empty-coalesce","last_synced_at":"2026-01-16T04:51:50.922Z","repository":{"id":62510446,"uuid":"444880982","full_name":"gglnx/twig-empty-coalesce","owner":"gglnx","description":"The empty test and default filter as an operator","archived":false,"fork":false,"pushed_at":"2022-01-12T10:57:16.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-20T07:52:31.158Z","etag":null,"topics":["twig","twig-extension","twig-syntax"],"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/gglnx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-01-05T16:52:22.000Z","updated_at":"2022-01-05T16:53:19.000Z","dependencies_parsed_at":"2022-11-02T13:16:31.973Z","dependency_job_id":null,"html_url":"https://github.com/gglnx/twig-empty-coalesce","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/gglnx/twig-empty-coalesce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglnx%2Ftwig-empty-coalesce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglnx%2Ftwig-empty-coalesce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglnx%2Ftwig-empty-coalesce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglnx%2Ftwig-empty-coalesce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gglnx","download_url":"https://codeload.github.com/gglnx/twig-empty-coalesce/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gglnx%2Ftwig-empty-coalesce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420814,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"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":["twig","twig-extension","twig-syntax"],"created_at":"2026-01-15T04:05:38.472Z","updated_at":"2026-01-15T04:05:39.208Z","avatar_url":"https://github.com/gglnx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Empty Coalesce Operator for Twig\n\n[![Packagist](https://img.shields.io/packagist/v/gglnx/twig-empty-coalesce.svg)](https://packagist.org/packages/gglnx/twig-empty-coalesce)\n\nThis library adds a new [operator expression](https://twig.symfony.com/doc/2.x/templates.html#expressions) to Twig with three question marks (`???`) to check if the left value is defined, not null and not empty. Works the same way as the [`empty` test](https://twig.symfony.com/doc/2.x/tests/empty.html) and the `|default` filter.\n\n```twig\n{% set _null = null %}\n{% set _empty = '' %}\n\n{# Null Coalesce: Output will be string(0) \"\" because _empty is defined and not exactly null #}\n{{ dump(_undefined ?? _null ?? _empty ?? 'fallback') }}\n\n{# Default Filter: Output will be string(8) \"fallback\" because _empty is defined, but an empty string #}\n{{ dump(_undefined | default(_null | default(_empty | default('fallback')))) }}\n\n{# Same as the default filter, but much more readable #}\n{{ dump(_undefined ??? _null ??? _empty ??? 'fallback') }}\n```\n\n## Requirements\n\n* Twig \u003e=2.14 and Twig \u003e=3.0\n* PHP \u003e=7.4\n\n## Installation\n\nThe recommended way to install this loader is via [Composer](https://getcomposer.org/):\n\n```bash\ncomposer require gglnx/twig-empty-coalesce\n```\n\nYou can install this library as extension in:  \n\n```php\nrequire_once '/path/to/vendor/autoload.php';\n\n$twig = new \\Twig\\Environment($loader);\n$twig-\u003eaddExtension(new \\Gglnx\\TwigEmptyCoalesce\\Extension\\EmptyCoalesceExtension());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgglnx%2Ftwig-empty-coalesce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgglnx%2Ftwig-empty-coalesce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgglnx%2Ftwig-empty-coalesce/lists"}