{"id":16894297,"url":"https://github.com/jsor/http-client-hints","last_synced_at":"2026-05-16T21:37:26.583Z","repository":{"id":57002399,"uuid":"51541558","full_name":"jsor/http-client-hints","owner":"jsor","description":"Utilities for working with HTTP Client Hints.","archived":false,"fork":false,"pushed_at":"2018-09-06T06:49:26.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T10:41:36.247Z","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/jsor.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":"2016-02-11T19:41:20.000Z","updated_at":"2019-01-11T16:18:30.000Z","dependencies_parsed_at":"2022-08-21T14:10:35.984Z","dependency_job_id":null,"html_url":"https://github.com/jsor/http-client-hints","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/jsor%2Fhttp-client-hints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsor%2Fhttp-client-hints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsor%2Fhttp-client-hints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsor%2Fhttp-client-hints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsor","download_url":"https://codeload.github.com/jsor/http-client-hints/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244591485,"owners_count":20477710,"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-10-13T17:18:17.102Z","updated_at":"2026-05-16T21:37:21.562Z","avatar_url":"https://github.com/jsor.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"HTTP Client Hints\n=================\n\n[![Build Status](https://travis-ci.org/jsor/http-client-hints.svg?branch=master)](https://travis-ci.org/jsor/http-client-hints?branch=master)\n[![Coverage Status](https://coveralls.io/repos/github/jsor/http-client-hints/badge.svg?branch=master)](https://coveralls.io/github/jsor/http-client-hints?branch=master)\n\nUtilities for working with\n[HTTP Client Hints](https://httpwg.org/http-extensions/client-hints.html).\n\nInstallation\n------------\n\nInstall the latest version with [Composer](https://getcomposer.org).\n\n```bash\ncomposer require jsor/http-client-hints\n```\n\nCheck the [Packagist page](https://packagist.org/packages/jsor/http-client-hints)\nfor all available versions.\n\nExample\n-------\n\n```php\n$resolved = (new Jsor\\HttpClientHints\\Resolver())\n    -\u003ewithAllowedHeaders([\n        // Process only Width and DPR headers\n        'Width',\n        'DPR',\n    ])\n    -\u003ewithMapping([\n        // Map Width header to w key\n        'width'  =\u003e 'w',\n        // Needed to extract the height from the query params\n        // for recalculation depending on Width if present\n        'height' =\u003e 'h',\n    ])\n    -\u003eresolve($_SERVER, $_GET)\n;\n\nif (isset($resolved['dpr'])) {\n    header('Content-DPR: ' . $resolved['dpr']);\n    header('Vary: DPR', false);\n}\n\nif (isset($resolved['w'])) {\n    header('Vary: Width', false);\n}\n\n// Use $resolved to generate thumbnails.\n// If you use Glide (https://github.com/thephpleague/glide), this could look\n// something like:\n\n$server = League\\Glide\\ServerFactory::create([\n    'source' =\u003e 'path/to/source/folder',\n    'cache' =\u003e 'path/to/cache/folder',\n]);\n$server-\u003eoutputImage($path, array_merge($_GET, $resolved));\n```\n\nLicense\n-------\n\nCopyright (c) 2016-2018 Jan Sorgalla. \nReleased under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsor%2Fhttp-client-hints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsor%2Fhttp-client-hints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsor%2Fhttp-client-hints/lists"}