{"id":20120562,"url":"https://github.com/gunantos/php_authentication","last_synced_at":"2025-05-06T14:33:05.525Z","repository":{"id":56949523,"uuid":"365994014","full_name":"gunantos/PHP_AUTHENTICATION","owner":"gunantos","description":"PHP Authentiation JWT, Basic, API KEY, Digest, Google login, Facebook login","archived":false,"fork":false,"pushed_at":"2022-09-11T13:26:33.000Z","size":83,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T14:08:42.336Z","etag":null,"topics":["api","api-key","auth","authentication","authorization","basic","basic-auth","digest","digest-authentication","facebook-login","google","jwt","jwt-authentication","oauth","php"],"latest_commit_sha":null,"homepage":"https://app-kita.com","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/gunantos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["gunantos"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["http://sponsor.app-kita.net/"]}},"created_at":"2021-05-10T09:51:16.000Z","updated_at":"2022-11-02T17:24:47.000Z","dependencies_parsed_at":"2022-08-21T03:10:18.786Z","dependency_job_id":null,"html_url":"https://github.com/gunantos/PHP_AUTHENTICATION","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunantos%2FPHP_AUTHENTICATION","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunantos%2FPHP_AUTHENTICATION/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunantos%2FPHP_AUTHENTICATION/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunantos%2FPHP_AUTHENTICATION/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gunantos","download_url":"https://codeload.github.com/gunantos/PHP_AUTHENTICATION/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252703475,"owners_count":21790891,"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":["api","api-key","auth","authentication","authorization","basic","basic-auth","digest","digest-authentication","facebook-login","google","jwt","jwt-authentication","oauth","php"],"created_at":"2024-11-13T19:21:26.471Z","updated_at":"2025-05-06T14:33:05.224Z","avatar_url":"https://github.com/gunantos.png","language":"PHP","readme":"# PHP AUTHENTICATION\n[APP KITA](https://app-kita.com)\n### _Simple Library PHP Authentication API_\n\n\u003ca href=\"https://app-kita.com\" alt=\"app-kita, app kita\"\u003e\u003cimg src=\"https://app-kita.com/img/logo-teks.965d24bf.png\" width=\"100\"\u003e\u003c/a\u003e\u003cbr\u003e\n[![Build Status](https://www.travis-ci.com/gunantos/PHP_AUTHENTICATION.svg?branch=main)](https://www.travis-ci.com/gunantos/PHP_AUTHENTICATION)\n\nSample Library PHP Authentication Restfull API\n\n- Support Multi Authentication\n\n### new version 2.1\n- add Session auth\n    ```php\n    use Appkita\\PHPAuth;\n    $config = [\n        'session' =\u003e [\n            'session_key'=\u003e'isLogin'\n        ]\n    ];\n    $auth = new Authentication($config);\n    $cek = $auth-\u003eauth(METHOD::SESSION, function($auth) {\n        return ($auth ? true : false);\n    });\n    ```\n\n- add Google Auth and Facebook Auth\n\n  ```php\n  $configApi = [\n      'google' = [\n      'clientID' =\u003e 'your client id',\n      'clientSecret' =\u003e 'secret client',\n      'redirectUri' =\u003e 'redirect url',\n    ];\n     'facebook' = [\n      'clientID' =\u003e 'your client id',\n      'clientSecret' =\u003e 'secret client',\n      'redirectUri' =\u003e 'redirect url',\n    ];\n  ]\n\n  //identifikasi Facebook Library\n  $FB = new \\Appkita\\PHPAuth\\Type\\Facebooklogin($configApi);\n  //identifikas google library\n  $GOOGLE = new \\Appkita\\PHPAuth\\Type\\GoogleLogin($this-\u003econfigApi);\n\n  //get FB login url\n  function loginFB() {\n      header('location:'. $FB-\u003eurlLogin());\n  }\n\n  //get Google Login url\n  function loginGoogle() {\n      header('location:'. $GOOGLE-\u003eurlLogin());\n  }\n\n  //url callback fb login to verify token\n  function verify_fb() {\n      return $FB-\u003edecode(function($user, $args, $error) {\n            die(json_encode($user));\n        });\n  }\n  //url callback fb Google to verify token\n  function verify_fb() {\n      return $FB-\u003edecode(function($user, $args, $error) {\n            die(json_encode($user));\n        }, []);\n  }\n  ```\n\n  more info [Google Doc] (https://github.com/googleapis/google-api-php-client)\n  more info [Facebook Document] (https://github.com/facebookarchive/php-graph-sdk)\n\n## Installation\n\nDillinger requires [PHP](https://php.net/) v7.0+ to run.\n\nInstall composer follow [composer](https://getcomposer.org/download/)\n\n```sh\ncomposer require appkita/phpauth\n```\n\nor\n\nEdit composer.json and update composer\n\n```sh\n{\n    \"require\": {\n        \"appkita/phpauth\": \"^0.1.*\"\n    }\n}\n```\n\n## Features\n\n- API KEY Authentication\n- JWT Authentication (Token)\n- Basic Authentication\n- Digest Authentication\n- Google Auth\n- Facebook Auth\n- SESSION\n\n## Using\n\n_configuration_\n\n```php\n  $config = [\n    'key_header'=\u003e'X-API-KEY', //Delete if you not use API KEY\n    //jwt Configuration\n    'key'=\u003e'key_JWT',\n    'data'=\u003e'username',\n    'timeout'=\u003e3600,\n    'iss'=\u003e'mydomain.com',\n    'aud'=\u003e'mydomain.com',\n    'basic_auth'=\u003e[\n        'username_key'=\u003e'email',\n        'password_key'=\u003e'password'\n    ];\n  ];\n  $auth = new Appkita\\PHPAuth\\Authentication($config);\n  //or\n  use Appkita\\PHPAuth;\n  $auth = new Authentication($config);\n  //or configuration default\n  $auth = new Authentication();\n```\n\n```php\n    $cek = $auth-\u003eauth(METHOD, callback);\n```\n\n_callback_ : is function to cek username or key you can set return or die\nbut if you using digest authentication you must return array\n\n```php\nreturn ['username'=\u003eusername, 'password'=\u003epassword];\n```\n\n```js\n    method Support\n    METHOD::Key = 'key',\n    METHOD::Basic = 'basic',\n    METHOD::Digest = 'digest'\n    METHOD::Token = 'token' //is JWT Authentication\n\n```\n\n_Example_\n\n### 1. KEY\n\n```php\n    $mykey = 'testingkey';\n    $cek = $auth-\u003eauth(METHOD::KEY, function($key) {\n        if ($key === $mykey) {\n            return true;\n        } else {\n            return false;\n        }\n    });\n```\n\n### 2. BASIC\n\n```php\n    $myusername = 'testingkey';\n    $mypassword = 'password';\n    $cek = $auth-\u003eauth(METHOD::BASIC, function($username, $password) {\n        if ($username == $myusername \u0026\u0026 $mypassword == $password) {\n            return true;\n        } else {\n            return false;\n        }\n    });\n```\n\n### 3. DIGEST\n\n```php\n    $myusername = 'testingkey';\n    $mypassword = 'password';\n    $cek = $auth-\u003eauth(METHOD::DIGEST, function($username, $password) {\n        if ($username == $myusername) {\n            return ['username'=\u003e$myusername, 'password'=\u003e$mypassword];\n        } else {\n            return false;\n        }\n    });\n```\n\n### 4. TOKEN (JWT)\n\n```php\n    $myusername = 'testingkey';\n    $cek = $auth-\u003eauth(METHOD::TOKEN, function($username) {\n        if ($username == $myusername) {\n            return true\n        } else {\n            return false;\n        }\n    });\n```\n\n## Development\n\nWant to contribute? Great!\n\nOpen your favorite Terminal and run these commands.\n\nFirst Tab:\n\n```sh\ngit clone git@github.com:gunantos/PHP_AUTHENTICATION.git\n```\n\nSecond Tab:\n\n```sh\ncd PHP_AUTHENTICATION\ncomposer install\n```\n\n## License\n\nMIT\n\n# Sponsor\n\n[Pay Coffe](https://github.com/sponsors/gunantos)\n","funding_links":["https://github.com/sponsors/gunantos","http://sponsor.app-kita.net/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunantos%2Fphp_authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgunantos%2Fphp_authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunantos%2Fphp_authentication/lists"}