{"id":21236819,"url":"https://github.com/dragonbe/connect-sdk-php","last_synced_at":"2025-07-10T18:30:55.553Z","repository":{"id":40915777,"uuid":"362600475","full_name":"DragonBe/connect-sdk-php","owner":"DragonBe","description":"The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructure and leverage the power of 1Password Secrets Automation","archived":false,"fork":false,"pushed_at":"2022-06-29T09:43:24.000Z","size":36,"stargazers_count":15,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T19:59:35.463Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DragonBe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-28T20:38:58.000Z","updated_at":"2024-04-25T07:27:02.000Z","dependencies_parsed_at":"2022-08-21T07:10:18.562Z","dependency_job_id":null,"html_url":"https://github.com/DragonBe/connect-sdk-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBe%2Fconnect-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBe%2Fconnect-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBe%2Fconnect-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DragonBe%2Fconnect-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DragonBe","download_url":"https://codeload.github.com/DragonBe/connect-sdk-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225648831,"owners_count":17502187,"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":[],"created_at":"2024-11-21T00:14:07.233Z","updated_at":"2024-11-21T00:14:07.923Z","avatar_url":"https://github.com/DragonBe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 1Password Connect PHP SDK\n\nThe 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your\ninfrastructure and leverage the power of [1Password Secrets Automation](https://1password.com/secrets)\n\nThe library can be used by PHP applications, tools, and other automations to access and manage items in 1Password\nVaults.\n\n## Installation\n\nYou can install the SDK using [composer](https://getcomposer.org/download/)\n\n```shell\ncomposer require dragonbe/connect-sdk-php\n```\n\n## Usage\n\nTo use the 1Password Connect SDK for PHP, there are two components necessary:\n\n1. The 1Password Connect SDK for PHP (this library)\n2. The 1Password Connect Server\n\nBesides these components, you need to configure 1Password (admin level) to allow \"Secrets Automation\". This process is\nfully documented by 1Password, so please\nvisit [1Password Secrets Automation Workflow](https://developer.1password.com/docs/connect) documentation first. Without\nthe 1Password Connect Server, this library will not work.\n\nThe rest of this documentation makes the assumption you have the 1Password Connect Server already configured and is\nlistening to port 8080 on localhost. With cURL it is possible to verify this.\n\n```shell\ncurl \\                   \n  -H \"Accept: application/json\" \\\n  -H \"Authorization: Bearer $OP_API_TOKEN\" \\\n  http://127.0.0.1:8080/v1/vaults\n```\n\nIf you receive a successful response with data from your vaults, you have successfully set up your 1Password Connect\nServer. If not, review the documentation to find out if you skipped a step.\n\n```json\n[\n  {\n    \"id\": \"xxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    \"name\": \"Shared Secrets\",\n    \"content_version\": 3,\n    \"description\": \"Shared secrets for APIs, online services, and more\",\n    \"attribute_version\": 1,\n    \"items\": 2,\n    \"type\": \"USER_CREATED\",\n    \"created_at\": \"2021-05-01T15:20:46Z\",\n    \"updated_at\": \"2022-06-22T14:33:39Z\"\n  }\n]\n```\n\nThe rest of this documentation will focus on the usage of the 1Password Connect SDK for PHP. \n\n## 1Password Connect SDK for PHP\n\n### Environment Variables\n\nIn this current version I'm not using environment variables.\n\n### Configuration Settings\n\nFor the configuration of the 1Password Connect SDK for PHP I use a PHP config file `local.php` in the directory `/config`. This file is ignored by source control, so it does not accidentally make it into the repository exposing the secret access token.\n\n```php\n\u003c?php\ndeclare(strict_types=1);\n\nreturn [\n    '1password' =\u003e [\n        'access_token' =\u003e '*******', // The access token you received from 1Password configuration\n    ],\n];\n```\n\n**PROTIP:** Make sure that this file is read-only, and only accessible for the user account that will run this SDK.\n\n### Creating an API client\n\nFor the API client (this library) we need to use this configuration file. The bare minimum you should code is the following:\n\n```php\n\u003c?php\ndeclare(strict_types=1);\n\nuse OnePassword\\Connect\\OnePasswordConnectFactory;\n\nrequire_once __DIR__ . '/../vendor/autoload.php';\n$config = require_once __DIR__ . '/config/local.php';\n\n$opc = OnePasswordConnectFactory::create($config['1password']['access_token']);\n```\n\n### Retrieving Vaults\n\nRetrieving a list of vaults who have been assigned to this access token, requires a few more lines.\n\n```php\n// List a list of vaults\n$vaults = $opc-\u003elistVaults();\nforeach ($vaults as $vault) {\n    echo 'Vault: ' . $vault-\u003egetName() . ' (' . $vault-\u003egetId() . ')' .PHP_EOL;\n}\n```\n\nThis will return something like the following output:\n\n```text\nVault: Shared Secrets (xxxxxxxxxxxxxxxxxxxxxxxxxx)\nShared Secrets contains 2 item(s)\n```\n\nTo retrieve items in those vaults, a few more lines are needed:\n\n```php\n$items = $opc-\u003elistItems('xxxxxxxxxxxxxxxxxxxxxxxxxx');\nforeach ($items as $item) {\n    echo 'Item title: ' . $item-\u003egetTitle() . PHP_EOL;\n}\n```\n\nThis will return you the following output:\n\n```text\nItem title: Azure Test Access Token: PHP SDK Example v1.0.0\nItem title: Azure API Manager\n```\n### Interacting with Items\n\n### Custom HTTPClient\n\n### Logging with psr/log\n\nThe 1Password Connect PHP client uses the [psr/log](https://packagist.org/packages/psr/log) library to log runtime\ninformation.\n\n## Development\n\nThis project is a work in progress and has been put a side for a while because of other priorities in life. Updates will appear if you watch this repository for updates.\n\n### Running Tests\n\nTo execute the unit tests, you can use `composer test` and it will fire up all PHPUnit tests.\n\n---\n\n# About 1Password\n\n**[1Password](https://1password.com/)** is the world’s most-loved password manager. By combining industry-leading\nsecurity and award-winning design, the company provides private, secure, and user-friendly password management to\nbusinesses and consumers globally. More than 60,000 business customers trust 1Password as their enterprise password\nmanager.\n\n# Security\n\n1Password requests you practice responsible disclosure if you discover a vulnerability. Please submit discoveries\nvia [BugCrowd](https://bugcrowd.com/agilebits).\n\nFor information about security practices, please visit our [Security homepage](https://1password.com/security/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdragonbe%2Fconnect-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdragonbe%2Fconnect-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdragonbe%2Fconnect-sdk-php/lists"}