{"id":23969733,"url":"https://github.com/thecodedrift/hotp-php","last_synced_at":"2025-05-16T09:03:05.181Z","repository":{"id":1306310,"uuid":"1248710","full_name":"thecodedrift/hotp-php","owner":"thecodedrift","description":"HMAC Based One Time Passwords in PHP.  RFC4226 and RFC6238 compliant.","archived":false,"fork":false,"pushed_at":"2025-02-19T19:37:31.000Z","size":56,"stargazers_count":51,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-12T04:47:29.021Z","etag":null,"topics":["hotp","hotp-generator","otp","php","totp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodedrift.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2011-01-13T00:45:15.000Z","updated_at":"2025-02-19T19:37:35.000Z","dependencies_parsed_at":"2025-02-25T09:00:22.661Z","dependency_job_id":"25f51bfb-d78d-4bb1-a833-f6515e964613","html_url":"https://github.com/thecodedrift/hotp-php","commit_stats":null,"previous_names":["thecodedrift/hotp-php"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fhotp-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fhotp-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fhotp-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fhotp-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodedrift","download_url":"https://codeload.github.com/thecodedrift/hotp-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254501555,"owners_count":22081528,"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":["hotp","hotp-generator","otp","php","totp"],"created_at":"2025-01-07T01:33:21.004Z","updated_at":"2025-05-16T09:03:05.150Z","avatar_url":"https://github.com/thecodedrift.png","language":"PHP","readme":"# HOTP - PHP Based HMAC One Time Passwords\n\n**What is HOTP**:\nHOTP is a class that simplifies One Time Password systems for PHP Authentication. The HOTP/TOTP Algorithms have been around for a bit, so this is a straightforward class to meet the test vector requirements.\n\n**What works with HOTP/TOTP**:\nIt's been tested to the test vectors, and I've verified the time-sync hashes against the following:\n\n- Android: Mobile-OTP\n- iPhone: OATH Token\n\n**Why would I use this**:\nWho wouldn't love a simple drop-in class for HMAC Based One Time Passwords? It's a great extra layer of security (creating two-factor auth) and it's pretty darn zippy.\n\n**Okay you sold me. Give me some docs**:\n\n```php\nuse jakobo\\HOTP\\HOTP;\n\n// event based\n$result = HOTP::generateByCounter( $key, $counter );\n\n// time based within a \"window\" of time\n$result = HOTP::generateByTime( $key, $window );\n\n// same as generateByTime, but for $min windows before and $max windows after\n$result = HOTP::generateByTimeWindow( $key, $window, $min, $max );\n```\n\nwith `$result`, you can do all sorts of neat things...\n\n```php\n$result-\u003etoString();\n\n$result-\u003etoHex();\n\n$result-\u003etoDec();\n\n// how many digits in your OTP?\n$result-\u003etoHotp( $length );\n```\n\n# Development\n\nIn order to support multiple PHP versions, a docker file and compose is available.\n\nTo build a php docker image with composer (and dependencies):\n\n```bash\n# Bring up the environment, mounts to /app in the container\ndocker compose up\n\n# Get into the PHP environment\ndocker compose exec php bash\n\n# Run composer\ncd /app\ncomposer install\ncomposer test\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fhotp-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodedrift%2Fhotp-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fhotp-php/lists"}