{"id":19326672,"url":"https://github.com/sroehrl/neoan3-stateless","last_synced_at":"2025-07-11T07:37:28.849Z","repository":{"id":46151290,"uuid":"189767936","full_name":"sroehrl/neoan3-stateless","owner":"sroehrl","description":"neoan3 app handling stateless authentication flow using JWT","archived":false,"fork":false,"pushed_at":"2024-04-23T23:04:09.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T23:51:49.417Z","etag":null,"topics":["hacktoberfest","jwt"],"latest_commit_sha":null,"homepage":"","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/sroehrl.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-01T18:57:21.000Z","updated_at":"2024-04-23T23:02:43.000Z","dependencies_parsed_at":"2024-11-10T02:14:31.396Z","dependency_job_id":"4f72a85a-8f7f-445b-a8b3-379569f4de5a","html_url":"https://github.com/sroehrl/neoan3-stateless","commit_stats":{"total_commits":15,"total_committers":4,"mean_commits":3.75,"dds":"0.33333333333333337","last_synced_commit":"0630d4555746a1c35538987c4228627f65a9bcef"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroehrl%2Fneoan3-stateless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroehrl%2Fneoan3-stateless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroehrl%2Fneoan3-stateless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sroehrl%2Fneoan3-stateless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sroehrl","download_url":"https://codeload.github.com/sroehrl/neoan3-stateless/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240427461,"owners_count":19799498,"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":["hacktoberfest","jwt"],"created_at":"2024-11-10T02:14:28.937Z","updated_at":"2025-02-24T06:21:22.852Z","avatar_url":"https://github.com/sroehrl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maintainability](https://api.codeclimate.com/v1/badges/5ef75b2080e797b9e9e5/maintainability)](https://codeclimate.com/github/sroehrl/neoan3-stateless/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/5ef75b2080e797b9e9e5/test_coverage)](https://codeclimate.com/github/sroehrl/neoan3-stateless/test_coverage)\n[![Build Status](https://travis-ci.com/sroehrl/neoan3-stateless.svg?branch=master)](https://travis-ci.com/sroehrl/neoan3-stateless)\n\n# PHP stateless JWT authentication\n\nEasy implementation of JWT authentication \u0026 handling in PHP. \n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Methods](#methods)\n\n\n\n## Installation \n\n`composer require neoan3-apps/stateless`\n\n\n## Quick Start\n\n\n```PHP\n// static\nNeoan3\\Apps\\Stateless::setSecret('My-super-secure-Key');\n\n// or as object\n// (method names are the same as static calls)\n$stateless = new Neoan3\\Apps\\StatelessOOP('my-secure-key');\n\n// create JWT\n$jti = 'someId';\n$scope = ['read', 'write'];\n$payload = ['additional'=\u003e'info']; // optional\n$jwt = Neoan3\\Apps\\Stateless::assign($jti, $scope, $payload);\n\n// validate JWT\ntry{\n    $decrypted = Neoan3\\Apps\\Stateless::validate();\n    $user = $decrypted['jti'];\n} catch(Exception $e) {\n    die('ups');\n}\n\n```\n\n## Methods\n\n### setAuthorization($jwt)\nIf this method is not used, _Stateless_ will read the Authorization from the $_SERVER variable \"HTTP_AUTHORIZATION\"\nand the following format \"bearer _token_\"\n\n### setCustomException($class)\nCan be used to trigger a custom exception when encountering validation errors.\n\n### setSecret($secret)\nKey used for the HS256 algorithm (decryption/encryption/signing). Make sure a key is set prior to any other interactions.\n\n### validate()\nReturns the decoded JWT or throws an Exception\n\n### restrict($scope = [])\nAccepts a string or an array. Same as _validate_, but additionally checks if the right kind of scope is present.\n\n### setExpiration($time | null)\nAccepts strtotime-compatible expression or epoch-stamp. \n\n### assign($jti, $scope, $payload = [])\nGenerates a JWT.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroehrl%2Fneoan3-stateless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsroehrl%2Fneoan3-stateless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsroehrl%2Fneoan3-stateless/lists"}