{"id":20128944,"url":"https://github.com/intervention/httpauth","last_synced_at":"2025-04-08T08:15:20.706Z","repository":{"id":6861068,"uuid":"8109917","full_name":"Intervention/httpauth","owner":"Intervention","description":"Library to manage HTTP authentication (Basic \u0026 Digest) with PHP","archived":false,"fork":false,"pushed_at":"2025-03-31T13:49:56.000Z","size":194,"stargazers_count":84,"open_issues_count":0,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-01T05:36:59.497Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://httpauth.intervention.io","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/Intervention.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["Intervention"],"ko_fi":"interventionphp","custom":"https://paypal.me/interventionio"}},"created_at":"2013-02-09T14:10:06.000Z","updated_at":"2025-03-31T13:49:59.000Z","dependencies_parsed_at":"2024-05-02T16:43:18.584Z","dependency_job_id":"97d41e12-e25a-4de1-ac3d-18c089bc0f1b","html_url":"https://github.com/Intervention/httpauth","commit_stats":{"total_commits":116,"total_committers":6,"mean_commits":"19.333333333333332","dds":"0.27586206896551724","last_synced_commit":"486574dee8579abd8473e3f753e3013a741404c9"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Intervention%2Fhttpauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Intervention%2Fhttpauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Intervention%2Fhttpauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Intervention%2Fhttpauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Intervention","download_url":"https://codeload.github.com/Intervention/httpauth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247801175,"owners_count":20998339,"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-13T20:30:43.504Z","updated_at":"2025-04-08T08:15:20.678Z","avatar_url":"https://github.com/Intervention.png","language":"PHP","funding_links":["https://github.com/sponsors/Intervention","https://ko-fi.com/interventionphp","https://paypal.me/interventionio"],"categories":[],"sub_categories":[],"readme":"# Intervention HttpAuth\n\nHTTP Authentication Management\n\n[![Latest Version](https://img.shields.io/packagist/v/intervention/httpauth.svg)](https://packagist.org/packages/intervention/httpauth)\n[![Tests](https://github.com/Intervention/httpauth/actions/workflows/build.yml/badge.svg)](https://github.com/Intervention/httpauth/actions/workflows/build.yml)\n[![Monthly Downloads](https://img.shields.io/packagist/dm/intervention/httpauth.svg)](https://packagist.org/packages/intervention/httpauth/stats)\n[![Support me on Ko-fi](https://raw.githubusercontent.com/Intervention/httpauth/main/.github/images/support.svg)](https://ko-fi.com/interventionphp)\n\n## Installation\n\nYou can easily install this library using [Composer](https://getcomposer.org).\nJust request the package with the following command:\n\n```bash\ncomposer require intervention/httpauth\n```\n\n## Documentation\n\nRead the full [documentation](https://httpauth.intervention.io) for this library.\n\n## Usage\n\nThe workflow is easy. Just create an instance of `Authenticator::class` in the first step\nand secure your resource in the second step.\n\n### 1. Create Authenticator Instance\n\nTo create authenticator instances you can choose between different methods.\n\n#### Create Instance by Using Static Factory Method\n\n```php\nuse Intervention\\HttpAuth\\Authenticator;\n\n// create http basic auth\n$auth = Authenticator::basic(\n    'myUsername',\n    'myPassword',\n    'Secured Area',\n);\n\n// create http digest auth\n$auth = Authenticator::digest(\n    'myUsername',\n    'myPassword',\n    'Secured Area',\n);\n```\n\n#### Create Instance by Using Class Constructor\n\n```php\nuse Intervention\\HttpAuth\\Authenticator;\n\n// alternatively choose DigestVault::class\n$vault = new BasicVault(\n    'myUsername',\n    'myPassword',\n    'Secured Area',\n);\n\n$auth = new Authenticator($vault);\n```\n\n#### Create Instance by Static Factory Method\n\n```php\nuse Intervention\\HttpAuth\\Authenticator;\n\n// alternatively choose DigestVault::class\n$vault = new BasicVault(\n    'myUsername',\n    'myPassword',\n    'Secured Area',\n);\n\n$auth = Authenticator::withVault($vault);\n```\n\n### 2. Ask User for Credentials\n\nAfter you created a HTTP authentication instance, you have to call `secure()`\nto secure the resource. This results in a 401 HTTP response and the browser\nasking for credentials.\n\n```php\n$auth-\u003esecure();\n```\n\nA character string can optionally be passed to the method. This is displayed if\nauthentication fails. Output from template engines can also be used here.\n\n```php\n$auth-\u003esecure('Sorry, you can not access this resource!');\n```\n\n## Server Configuration\n\n### Apache\n\nIf you are using Apache and running PHP with CGI/FastCGI, check the server\nconfiguration to make sure the authorization headers are passed correctly to PHP:\n\nhttps://support.deskpro.com/en/kb/articles/missing-authorization-headers-with-apache\n\n## Authors\n\nThis library is developed and maintained by [Oliver Vogel](https://intervention.io)\n\nThanks to the community of [contributors](https://github.com/Intervention/httpauth/graphs/contributors) who have helped to improve this project.\n\n## License\n\nIntervention HttpAuth is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintervention%2Fhttpauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintervention%2Fhttpauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintervention%2Fhttpauth/lists"}