{"id":15178947,"url":"https://github.com/shubham16g/php-fast-auth","last_synced_at":"2026-03-02T13:33:28.112Z","repository":{"id":64441129,"uuid":"352104517","full_name":"shubham16g/php-fast-auth","owner":"shubham16g","description":"Easy and Fast PHP authentication (MySQL Database)","archived":false,"fork":false,"pushed_at":"2022-12-08T12:41:51.000Z","size":152,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T03:46:29.138Z","etag":null,"topics":["auth","authentication","mysql-database","otp-verification","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shubham16g.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":"2021-03-27T15:15:10.000Z","updated_at":"2023-09-29T09:12:27.000Z","dependencies_parsed_at":"2023-01-13T14:45:04.770Z","dependency_job_id":null,"html_url":"https://github.com/shubham16g/php-fast-auth","commit_stats":null,"previous_names":["shubham16g/php-fast-auth","shubham-gupta-16/php-fast-auth"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/shubham16g/php-fast-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham16g%2Fphp-fast-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham16g%2Fphp-fast-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham16g%2Fphp-fast-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham16g%2Fphp-fast-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shubham16g","download_url":"https://codeload.github.com/shubham16g/php-fast-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham16g%2Fphp-fast-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30004592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T12:19:43.414Z","status":"ssl_error","status_checked_at":"2026-03-02T12:19:02.215Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["auth","authentication","mysql-database","otp-verification","php"],"created_at":"2024-09-27T15:42:40.015Z","updated_at":"2026-03-02T13:33:28.091Z","avatar_url":"https://github.com/shubham16g.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast-Auth\nEasy and Fast PHP authentication (MySQL Database)\n\n## Docs\n\n### Initialize\nPHPFastAuth requires mysqli object to connect with your MYSQL database.\n\nYou can use $mysqli_db = new mysqli($host, $username, $password, $dbname);\n\n    try {\n        $auth = new PHPFastAuth($mysqli_db);\n    } catch (Exception $e) {\n        echo $e-\u003egetMessage();\n    }\n\nor\n\n    try {\n        $options = new PHPFastAuth\\Options();\n        $options-\u003esetOTPLength(4);\n\n        $auth = new PHPFastAuth($mysqli_db, $options);\n    } catch (Exception $e) {\n        echo $e-\u003egetMessage();\n    }\n\n### Install\nThis code must be called once to create required tables in your database.\n\n    try {\n        $auth = new PHPFastAuth($mysqli_db);\n        $auth-\u003einstall();\n    } catch (Exception $e) {\n        echo $e-\u003egetMessage();\n    }\n\n### OTP Sign up with Mobile\n\n    try {\n        $auth = new PHPFastAuth($db);\n\n        $signUp = new PHPFastAuth\\SignUpWithMobile($mobile);\n        $signUp-\u003esetName($name);\n        $signUp-\u003esetPassword($password);\n\n    \u003c!-- this key used to decode and verify OTP--\u003e\n        $key = $auth-\u003esignUpRequest($signUp);\n\n    \u003c!-- OTPData contains the otp, case, name, type (\"mobile\" or \"email\"), mobile, email--\u003e\n        $otpData = $auth-\u003edecodeOTP($key);\n\n        $mobile = $otpData-\u003egetMobile();            \n        $otp = $otpData-\u003egetOTP();\n\n    \u003c!-- your custom method to send OTP --\u003e\n        sendOTPviaSMS($mobile, $otp);\n\n    } catch (Exception $e) {\n        echo $e-\u003egetMessage();\n    }\n\n### OTP Sign up with Email\n\n    try {\n        $auth = new PHPFastAuth($db);\n\n        $signUp = new PHPFastAuth\\SignUpWithEmail($email);\n        $signUp-\u003esetName($name);\n        $signUp-\u003esetPassword($password);\n\n    \u003c!-- this key used to decode and verify OTP--\u003e\n        $key = $auth-\u003esignUpRequest($signUp);\n\n    \u003c!-- OTPData contains the otp, case, name, type (\"mobile\" or \"email\"), mobile, email--\u003e\n        $otpData = $auth-\u003edecodeOTP($key);\n\n        $email = $otpData-\u003egetEmail();            \n        $otp = $otpData-\u003egetOTP();\n\n    \u003c!-- your custom method to send OTP --\u003e\n        sendOTPviaEmail($email, $otp);\n\n    } catch (Exception $e) {\n        echo $e-\u003egetMessage();\n    }\n\n### Verify OTP\n    \u003c!-- restul is a array conatinig info based on case. --\u003e\n    $result = $auth-\u003everifyOTP($key, $otp);\n\n    switch ($result['case']) {\n        case PHPFastAuth::CASE_UPDATE_PASSWORD:\n            $passwordUpdateKey = $result['passwordUpdateKey'];\n            header(\"Location: reset_password.php?passwordUpdateKey=\" . urlencode($passwordUpdateKey));\n            die();\n            break;\n        case PHPFastAuth::CASE_NEW_USER:\n            $signIn = new PHPFastAuth\\SignInWithUID($result['uid']);\n            $signInResult = $auth-\u003esignInWithoutPassword($signIn);\n            $_SESSION['token'] = $signInResult['token'];\n            $_SESSION['isAnonymous'] = $signInResult['isAnonymous'];\n            // $content = json_encode($signInResult);\n            $title = \"Account verification successful\";\n            break;\n        case PHPFastAuth::CASE_UPDATE_EMAIL:\n            $title = \"Email update successful\";\n            break;\n        case PHPFastAuth::CASE_UPDATE_MOBILE:\n            $title = \"Mobile number update successful\";\n            break;\n        default:\n            throw new Exception(\"Error in verify_otp.php: no such case\", 1);\n            break;\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham16g%2Fphp-fast-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubham16g%2Fphp-fast-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham16g%2Fphp-fast-auth/lists"}