{"id":15296339,"url":"https://github.com/mle86/php-request-authentication","last_synced_at":"2026-02-17T00:31:31.804Z","repository":{"id":57018169,"uuid":"130746636","full_name":"mle86/php-request-authentication","owner":"mle86","description":"🔒🔍 A simple library for API request authentication.","archived":false,"fork":false,"pushed_at":"2018-11-12T14:13:23.000Z","size":250,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T19:13:12.008Z","etag":null,"topics":["api-authentication","api-wrapper","authentication","authentication-middleware","http-requests","php-library","php7","php71","signature-verification"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mle86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-23T19:30:57.000Z","updated_at":"2018-11-12T14:13:21.000Z","dependencies_parsed_at":"2022-08-22T11:30:55.053Z","dependency_job_id":null,"html_url":"https://github.com/mle86/php-request-authentication","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/mle86/php-request-authentication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mle86%2Fphp-request-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mle86%2Fphp-request-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mle86%2Fphp-request-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mle86%2Fphp-request-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mle86","download_url":"https://codeload.github.com/mle86/php-request-authentication/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mle86%2Fphp-request-authentication/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29526678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T21:45:09.491Z","status":"ssl_error","status_checked_at":"2026-02-16T21:44:58.452Z","response_time":115,"last_error":"SSL_read: 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":["api-authentication","api-wrapper","authentication","authentication-middleware","http-requests","php-library","php7","php71","signature-verification"],"created_at":"2024-09-30T18:10:09.491Z","updated_at":"2026-02-17T00:31:31.773Z","avatar_url":"https://github.com/mle86.png","language":"PHP","readme":"# php-request-authentication\n\n[![Build Status](https://travis-ci.org/mle86/php-request-authentication.svg?branch=master)](https://travis-ci.org/mle86/php-request-authentication)\n[![Coverage Status](https://coveralls.io/repos/github/mle86/php-request-authentication/badge.svg?branch=master)](https://coveralls.io/github/mle86/php-request-authentication?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/mle86/request-authentication/version)](https://packagist.org/packages/mle86/request-authentication)\n[![PHP 7.1](https://img.shields.io/badge/php-7.1-8892BF.svg?style=flat)](https://php.net/)\n[![License](https://poser.pugx.org/mle86/request-authentication/license)](https://packagist.org/packages/mle86/request-authentication)\n\nThis PHP library provides a generic interface for authenticating outbound API requests\nand for verifying inbound API requests' authentication.\n\nIt is released under the [MIT License](https://opensource.org/licenses/MIT).\n\n\n## Installation\n\nVia Composer:  `$ composer require mle86/request-authentication`\n\nOr insert this into your project's `composer.json` file:\n\n```json\n\"require\": {\n    \"mle86/request-authentication\": \"^0\"\n}\n```\n\n\n## Dependencies and Minimum PHP Version\n\n- PHP 7.1\n\n- The [PSR-7](https://www.php-fig.org/psr/psr-7/) interfaces ([psr/http-message](https://github.com/php-fig/http-message))\n- The [PSR-15](https://www.php-fig.org/psr/psr-15/) interfaces ([psr/http-server-middleware](https://github.com/php-fig/http-server-handler))\n\n- The [whitehat101/apr1-md5](https://packagist.org/packages/whitehat101/apr1-md5) package for `$apr1$` hash support in [BasicHashAuthenticationMethod]\n- The [paragonie/halite](https://packagist.org/packages/paragonie/halite) package for the [PublicKeyMethod] class\n\n\n## Workflow\n\nThis library contains several [AuthenticationMethod] classes.\n\nEach of those represents one mechanism for request authentication and verification.\nThe [BasicAuthenticationMethod] for example adds an `Authorization: Basic …` HTTP header to outbound requests\nand verifies that header in inbound requests against a list of known usernames and their passwords.\n\nUsually the [AuthenticationMethod] classes won't be used directly\n(apart from instantiating them),\nthere's the [RequestAuthenticator] and [RequestVerifier] wrapper classes instead\nthat take an AuthenticationMethod dependency.\n\n**To sign/authenticate an outbound request**\nyou'll need an [AuthenticationMethod] instance\nwrapped in a [RequestAuthenticator] instance,\na client ID and a client secret,\nand the request to sign.\nThe `authenticate()` method will add\nthe required authentication headers\nto the request\nso that it can be sent.\n\n**To verify an inbound request**\nyou'll need an [AuthenticationMethod] instance of the same class\nwrapped in a [RequestVerifier] instance\nand a [KeyRepository] that will map the request's client ID\nto the same client secret used for signing the request.  \n(In case of the [PublicKeyMethod] class,\nthe client will use its private key for signing\nand the [KeyRepository] must return the client's public key.)\n\n\n## Classes and Interfaces\n\n* **Main wrapper classes:**\n    * [RequestAuthenticator] wrapper class,\n    * [RequestVerifier] wrapper class.\n* **[AuthenticationMethod] main interface:**\n    * [BasicAuthenticationMethod] class,\n    * [BasicHashAuthenticationMethod] class,\n    * [DefaultAuthenticationMethod] class,\n    * [PublicKeyMethod] class,\n    * [MethodStack] composite class.\n* [RequestInfo] data transfer object.\n* [KeyRepository] base class:\n    * [FileRepository] class,\n    * [ArrayRepository] class.\n* [RequestIdList] interface:\n    * [CacheRequestIdList] class.\n* [Exception] classes.\n\n\n## More Documentation\n\n* [Usage Example with htpasswd file](doc/Example_htpasswd.md)\n* [Request IDs and Ensuring Request Uniqueness](doc/Request_IDs.md)\n\n\n[RequestAuthenticator]: doc/Class_RequestAuthenticator.md\n[RequestVerifier]: doc/Class_RequestVerifier.md\n[AuthenticationMethod]: doc/Class_AuthenticationMethod.md\n[BasicAuthenticationMethod]: doc/Class_BasicAuthenticationMethod.md\n[BasicHashAuthenticationMethod]: doc/Class_BasicHashAuthenticationMethod.md\n[DefaultAuthenticationMethod]: doc/Class_DefaultAuthenticationMethod.md\n[PublicKeyMethod]: doc/Class_PublicKeyMethod.md\n[RequestInfo]: doc/Class_RequestInfo.md\n[KeyRepository]: doc/Class_KeyRepository.md\n[ArrayRepository]: doc/Class_ArrayRepository.md\n[FileRepository]: doc/Class_FileRepository.md\n[Exception]: doc/Exceptions.md\n[MethodStack]: doc/Class_MethodStack.md\n[RequestIdList]: doc/Class_RequestIdList.md\n[CacheRequestIdList]: doc/Class_CacheRequestIdList.md\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmle86%2Fphp-request-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmle86%2Fphp-request-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmle86%2Fphp-request-authentication/lists"}