{"id":36995367,"url":"https://github.com/thamtech/yii2-jws","last_synced_at":"2026-01-13T23:47:41.820Z","repository":{"id":57067540,"uuid":"43779475","full_name":"thamtech/yii2-jws","owner":"thamtech","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-09T19:59:15.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-23T13:07:35.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thamtech.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":{"liberapay":"thamtech"}},"created_at":"2015-10-06T21:21:10.000Z","updated_at":"2020-12-09T19:59:17.000Z","dependencies_parsed_at":"2022-08-24T10:20:13.298Z","dependency_job_id":null,"html_url":"https://github.com/thamtech/yii2-jws","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/thamtech/yii2-jws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thamtech%2Fyii2-jws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thamtech%2Fyii2-jws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thamtech%2Fyii2-jws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thamtech%2Fyii2-jws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thamtech","download_url":"https://codeload.github.com/thamtech/yii2-jws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thamtech%2Fyii2-jws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2026-01-13T23:47:41.698Z","updated_at":"2026-01-13T23:47:41.813Z","avatar_url":"https://github.com/thamtech.png","language":"PHP","funding_links":["https://liberapay.com/thamtech"],"categories":[],"sub_categories":[],"readme":"yii2-jws\n========\n\nAn extension to manage signed JWS tokens\n\nThis library interfaces with\n[namshi/jose](https://github.com/namshi/jose) to generate signed\n[JWS](https://tools.ietf.org/html/rfc7515) tokens.\n\nFor license information check the [LICENSE](LICENSE.md)-file.\n\nInstallation\n------------\n\nThe preferred way to install this extensions is through [composer](https://getcomposer.org/download/).\n\nEither run\n```\nphp composer.phar require --prefer-dist thamtech/yii2-jws\n```\nor add\n```\n\"thamtech/yii2-jws\": \"*\"\n```\nto the `require` section of your `composer.json` file.\n\nIntegration\n-----------\n\n1. [Generate a kepair using OpenSSL](https://en.wikibooks.org/wiki/Cryptography/Generate_a_keypair_using_OpenSSL)\n   and store the keys in public.pem and private.pem.\n\n2. Add the JwsManager application component in your site configuration:\n\n    ```php\n    return [\n      'components' =\u003e [\n        'jwsManager' =\u003e [\n          'class' =\u003e 'thamtech\\jws\\components\\JwsManager',\n          'pubkey' =\u003e '@app/config/keys/jws/public.pem',\n          'pvtkey' =\u003e '@app/config/keys/jws/private.pem',\n          \n          // The settings below are optional. Defaults will be used if not set here.\n          //'encoder' =\u003e 'Namshi\\JOSE\\Base64\\Base64UrlSafeEncoder',\n          //'exp' =\u003e '1 hour',\n          //'alg' =\u003e 'RS256',\n          //'jwsClass' =\u003e 'Namshi\\JOSE\\SimpleJWS',\n        ],\n      ]\n    ]\n    ```\n\nUsage\n-----\n\nGenerate a new token:\n```php\n$payload = [\n  \"user_id\": 23,\n  \"foo\": \"bar\",\n];\n$tokenString = Yii::$app-\u003ejwsManager-\u003enewToken($payload);\n```\n\nVerify that this string is a token that we signed:\n```php\n$token = Yii::$app-\u003ejwsManager-\u003eload($tokenString);\n$result = Yii::$app-\u003ejwsManager-\u003everify($token);\n```\n\nVerify that this string is a token that we signed AND (if it is an instance\nof `\\Namshi\\JOSE\\SimpleJWS` wih an expiration) that it is not expired:\n```php\n$token = Yii::$app-\u003ejwsManager-\u003eload($tokenString);\n$result = Yii::$app-\u003ejwsManager-\u003eisValid($token);\n```\n\nSee Also\n--------\n\n* [cranetm/yii2-json-rpc-2.0](https://github.com/cranetm/yii2-json-rpc-2.0) - Yii 2\n  extension that helps turn your Controllers into JSON RPC 2.0 APIs.\n  \n* [namshi/jose](https://github.com/namshi/jose) - PHP implementation of the\n  JWS (JSON Web Signature) specification.\n\n* [JSON Web Token (JWT)](https://tools.ietf.org/html/rfc7519) - JWT specifications\n  \n* [JSON Web Signature (JWS)](https://tools.ietf.org/html/rfc7515) - JWS specifications\n\n* [thamtech/yii2-jsonrpc-jwsauth](https://github.com/thamtech/yii2-jsonrpc-jwsauth)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthamtech%2Fyii2-jws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthamtech%2Fyii2-jws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthamtech%2Fyii2-jws/lists"}