{"id":19987631,"url":"https://github.com/raederdev/http-2-server-push-twig","last_synced_at":"2026-05-14T19:06:38.536Z","repository":{"id":40825950,"uuid":"168779841","full_name":"RaederDev/http-2-server-push-twig","owner":"RaederDev","description":"Plugin for Craft CMS that provides a twig filter for generating a Link HTTP header","archived":false,"fork":false,"pushed_at":"2022-06-28T00:51:07.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-12T11:45:59.643Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RaederDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-02T01:04:31.000Z","updated_at":"2022-06-27T21:32:28.000Z","dependencies_parsed_at":"2022-09-05T15:51:36.862Z","dependency_job_id":null,"html_url":"https://github.com/RaederDev/http-2-server-push-twig","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaederDev%2Fhttp-2-server-push-twig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaederDev%2Fhttp-2-server-push-twig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaederDev%2Fhttp-2-server-push-twig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RaederDev%2Fhttp-2-server-push-twig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RaederDev","download_url":"https://codeload.github.com/RaederDev/http-2-server-push-twig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241424933,"owners_count":19960836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-13T04:37:31.397Z","updated_at":"2025-11-26T01:04:33.967Z","avatar_url":"https://github.com/RaederDev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP/2 Server Push Twig plugin for Craft CMS 4.x\n\nThis plugin provides a convenient way to utilize Server Push via a twig filter\n\n## Requirements\n\nThis plugin requires Craft CMS 4.0.0 or later.\n\n## Installation\n\nTo install the plugin, follow these instructions.\n\n1. Open your terminal and go to your Craft project:\n\n        cd /path/to/project\n\n2. Then tell Composer to load the plugin:\n\n        composer require raeder/craft-http2-server-push-twig\n\n3. In the Control Panel, go to Settings → Plugins and click the “Install” button for HTTP/2 Server Push Twig.\n\n## HTTP/2 Server Push Twig Overview\n\nThis plugin adds a twig filter that allows you to send a \"Link\" header to your web-server to enable HTTP/2 Server Push.\nYou will still have to configure your web-server to interpret the Link header and push the assets.\n\n## Using HTTP/2 Server Push Twig\n\nYou can add any asset that should be included in the Link header like this:\n```\n\u003clink rel=\"stylesheet\" href=\"{{ '/css/blog.css' | h2push }}\"\u003e\n```\n\nCSS, JS and image files are supported out of the box. If you want to push another asset type you can pass the type like this:\n```\n\u003clink rel=\"stylesheet\" href=\"{{ '/uploads/test.mp3' | h2push('audio') }}\"\u003e\n```\n\nA full list of supported types can be found here: https://fetch.spec.whatwg.org/#concept-request-destination\nIt's also possible to mark an asset as crossorigin:\n```\n\u003clink rel=\"stylesheet\" href=\"{{ '/uploads/test.mp3' | h2push('audio', true) }}\"\u003e\n```\n\nAfter your site template was rendered by craft a hook will generate the Header.\nIf you're using Caddy you can find an example on how to configure your server in my blog-post: https://www.raeder.technology/post/practical-php-implementation-for-http-2-server-push\n\n## Using HTTP/2 Server Push Twig modulepreload\n\nModule preload headers are an experimental browser feature so tread carefully.\nTo push your module file use the h2module filter:\n```\n\u003cscript type=\"module\" src=\"{{ 'app.js' | h2module }}\"\u003e\u003c/script\u003e\n```\n\nPlease note that you must add 'type=\"module\"' to your script tag, otherwise Google Chrome will not support import and export features.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraederdev%2Fhttp-2-server-push-twig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraederdev%2Fhttp-2-server-push-twig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraederdev%2Fhttp-2-server-push-twig/lists"}