{"id":17948846,"url":"https://github.com/eko/authz-php-sdk","last_synced_at":"2025-10-28T05:35:42.438Z","repository":{"id":65240980,"uuid":"588305187","full_name":"eko/authz-php-sdk","owner":"eko","description":"Authz PHP SDK","archived":false,"fork":false,"pushed_at":"2023-07-07T05:43:32.000Z","size":330,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T13:08:02.068Z","etag":null,"topics":["abac","authorization","permissions","php","rbac"],"latest_commit_sha":null,"homepage":"https://authz.fr","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/eko.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":"2023-01-12T20:11:05.000Z","updated_at":"2023-08-03T18:26:08.000Z","dependencies_parsed_at":"2024-10-29T09:42:40.334Z","dependency_job_id":null,"html_url":"https://github.com/eko/authz-php-sdk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/eko/authz-php-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-php-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-php-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-php-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-php-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eko","download_url":"https://codeload.github.com/eko/authz-php-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-php-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264599490,"owners_count":23635306,"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":["abac","authorization","permissions","php","rbac"],"created_at":"2024-10-29T09:10:20.565Z","updated_at":"2025-10-28T05:35:37.393Z","avatar_url":"https://github.com/eko.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authz PHP SDK\n\nThis is the Authz development kit for PHP.\n\n## Installation\n\nYou can install the SDK in your project by adding the following dependency:\n\n```bash\n$ composer require eko/authz-sdk\n```\n\n⚠️  Please note that you will need to install the [`grpc` PHP extension](https://cloud.google.com/php/grpc).\n\n## Usage\n\nYou have to instanciate a new Authz Client in your code by doing:\n\n```php\n\u003c?php\nuse Eko\\AuthzSdk\\Client;\n\n$client = new Client('localhost:8081', '\u003cclient_id\u003e', '\u003cclient_secret\u003e');\n```\n\nOnce the client is instanciate, you have access to all the gRPC methods.\n\nIn order to create a new Principal, you can use\n\n```php\n[$response, $status] = $client-\u003ePrincipalCreate(new PrincipalCreateRequest([\n    'id' =\u003e 'user-123',\n    'attributes' =\u003e [\n        new Attribute(['key' =\u003e 'email', 'value' =\u003e 'johndoe@acme.tld']),\n    ],\n]))-\u003ewait();\n```\n\nTo declare a new resource:\n\n```php\n[$response, $status] = $client-\u003eResourceCreate(new ResourceCreateRequest([\n    'id' =\u003e 'post.123',\n    'kind' =\u003e 'post',\n    'value' =\u003e '123',\n    'attributes' =\u003e [\n        new Attribute(['key' =\u003e 'owner_email', 'value' =\u003e 'johndoe@acme.tld']),\n    ],\n]))-\u003ewait();\n```\n\nYou can also declare a new policy this way:\n\n```php\n[$response, $status] = $client-\u003ePolicyCreate(new PolicyCreateRequest([\n    'id' =\u003e 'post-owners',\n    'resources' =\u003e ['post.*'],\n    'actions' =\u003e ['edit', 'delete'],\n    'attribute_rules' =\u003e [\n        'principal.email == resource.owner_email',\n    ],\n]))-\u003ewait();\n```\n\nThen, you can perform a check with:\n\n```php\nif ($client-\u003eIsAllowed('user-123', 'post', '123', 'edit')) {\n    // Do something\n}\n```\n\nPlease note that you have access to all the gRPC methods [declared here](https://github.com/eko/authz/blob/master/backend/api/proto/api.proto) in the proto file.\n\n## Configuration\n\nThis SDK connects over gRPC to the backend service. Here are the available configuration options:\n\n| Property | Description |\n| -------- | ----------- |\n| Address | Authz backend to connect to |\n| ClientID | Your service account client id used to authenticate |\n| ClientSecret | Your service account client secret key used to authenticate |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fauthz-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feko%2Fauthz-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fauthz-php-sdk/lists"}