{"id":15029292,"url":"https://github.com/melbahja/http2pusher","last_synced_at":"2025-04-09T20:32:35.223Z","repository":{"id":56283721,"uuid":"107785704","full_name":"melbahja/Http2Pusher","owner":"melbahja","description":"PHP Http2 Server Push","archived":false,"fork":false,"pushed_at":"2020-11-16T22:04:18.000Z","size":9,"stargazers_count":27,"open_issues_count":0,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-23T22:26:03.525Z","etag":null,"topics":["http","http2","http2-push","php","php-library","php7"],"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/melbahja.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}},"created_at":"2017-10-21T14:11:06.000Z","updated_at":"2024-09-21T14:24:39.000Z","dependencies_parsed_at":"2022-08-15T16:00:43.561Z","dependency_job_id":null,"html_url":"https://github.com/melbahja/Http2Pusher","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2FHttp2Pusher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2FHttp2Pusher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2FHttp2Pusher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2FHttp2Pusher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melbahja","download_url":"https://codeload.github.com/melbahja/Http2Pusher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248107630,"owners_count":21048970,"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":["http","http2","http2-push","php","php-library","php7"],"created_at":"2024-09-24T20:10:14.087Z","updated_at":"2025-04-09T20:32:35.147Z","avatar_url":"https://github.com/melbahja.png","language":"PHP","readme":"# Http2Pusher\nPHP Http2 Server Pusher\n\n## About Http2 Server Push :\n\n\u003e HTTP/2 Push allows a web server to send resources to a web browser before the browser gets to request them. It is, for the most part, a performance technique that can help some websites load faster. - [wikipedia](https://en.wikipedia.org/wiki/HTTP/2_Server_Push)\n\n![http2](https://blog.cloudflare.com/content/images/2015/12/http-2-multiplexing.png)\nimage by cloudflare\n\n## Installation :\n\nusing composer: ```composer require melbahja/http2-pusher```\n\n## Usage :\n\nget the instance:\n```php\n\nrequire 'vendore/autoload.php';\n\nuse Melbahja\\Http2\\Pusher;\n\n$pusher = Pusher::getInstance();\n\n``` \n\nexamples:\n\n```php\n\n// set css file\n$pusher-\u003elink('/assets/css/style.css');\n\n// set css and image and src\n$pusher-\u003elink('/asstes/css/main.css')\n\t-\u003esrc('/assets/js/scripts.js')\n\t-\u003eimg('/assets/img/logo.png')\n\t-set(Pusher::IMG, '/assets/img/logo2.png');\n\n\n// set link with options\n$pusher-\u003elink('https://fonts.gstatic.com', [\n\t'as' =\u003e false,\n\t'rel' =\u003e 'preconnect' \n]);\t\n\n// rel by default is preload\n// as by default is the link type \n\n\n// push header\n$pusher-\u003epush();\n\n```\n\n## Public methods :\n\n```\nPusher::getInstance(): PusherInterface\n\nPusher::link(string $link, array $opts = []): PusherInterface\n\nPusher::src(string $link, array $opts = []): PusherInterface\n\nPusher::img(string $link, array $opts = []): PusherInterface\n\nPusher::set(string $type, string $link, array $opts = []): PusherInterface\n\nPusher::getHeader(string $type = null): string\n\nPusher::push(string $type = null): void\n\nPusher::public function toHeader(string $type, array $urls): null|string\n```\n\n## License :\n\n[MIT](https://github.com/melbahja/Http2Pusher/blob/master/LICENSE) Copyright (c) 2017 Mohamed Elbahja\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbahja%2Fhttp2pusher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelbahja%2Fhttp2pusher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbahja%2Fhttp2pusher/lists"}