{"id":18550305,"url":"https://github.com/xp-forge/credentials","last_synced_at":"2025-05-15T10:09:01.577Z","repository":{"id":45636518,"uuid":"65691311","full_name":"xp-forge/credentials","owner":"xp-forge","description":"Credentials","archived":false,"fork":false,"pushed_at":"2024-03-24T10:29:01.000Z","size":103,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T21:59:01.360Z","etag":null,"topics":["hashicorp-vault","keepass-database","password-store","php7","php8","secrets","xp-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xp-forge.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":null,"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":"2016-08-14T23:37:59.000Z","updated_at":"2022-02-27T18:29:11.000Z","dependencies_parsed_at":"2024-03-30T16:45:14.193Z","dependency_job_id":null,"html_url":"https://github.com/xp-forge/credentials","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fcredentials","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fcredentials/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fcredentials/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xp-forge%2Fcredentials/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xp-forge","download_url":"https://codeload.github.com/xp-forge/credentials/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319722,"owners_count":22051075,"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":["hashicorp-vault","keepass-database","password-store","php7","php8","secrets","xp-framework"],"created_at":"2024-11-06T21:04:10.922Z","updated_at":"2025-05-15T10:09:01.557Z","avatar_url":"https://github.com/xp-forge.png","language":"PHP","readme":"Credentials\n=====\n\n[![Build status on GitHub](https://github.com/xp-forge/credentials/workflows/Tests/badge.svg)](https://github.com/xp-forge/credentials/actions)\n[![XP Framework Module](https://raw.githubusercontent.com/xp-framework/web/master/static/xp-framework-badge.png)](https://github.com/xp-framework/core)\n[![BSD Licence](https://raw.githubusercontent.com/xp-framework/web/master/static/licence-bsd.png)](https://github.com/xp-framework/core/blob/master/LICENCE.md)\n[![Requires PHP 7.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-7_0plus.svg)](http://php.net/)\n[![Supports PHP 8.0+](https://raw.githubusercontent.com/xp-framework/web/master/static/php-8_0plus.svg)](http://php.net/)\n[![Latest Stable Version](https://poser.pugx.org/xp-forge/credentials/version.png)](https://packagist.org/packages/xp-forge/credentials)\n\nCredentials storage\n\nBackends\n--------\nThis API supports the following backends:\n\n* [Files](https://github.com/xp-forge/credentials#files)\n* [Environment variables](https://github.com/xp-forge/credentials#environment-variables)\n* [Hashicorp's Vault](https://github.com/xp-forge/credentials#hashicorps-vault) \n* [KeePass databases](https://github.com/xp-forge/credentials#keepass-databases)\n* [Docker Secrets](https://github.com/xp-forge/credentials#docker-secrets)\n\n### Files\n\nVia the `FromFile` class. Files are expected to have the following format:\n\n```\nrest_password=abcdefg\nldap_password=qwertzu\n```\n\n### Environment variables\n\nVia the `FromEnvironment` class. Credential names map to environment variables by uppercasing them and replacing forward slashes by two underscores:\n\n```php\nuse security\\credentials\\{Credentials, FromEnvironment};\n\n$credentials= new Credentials(new FromEnvironment());\n$secret= $credentials-\u003enamed('ldap_password');     // Reads $ENV{LDAP_PASSWORD} =\u003e util.Secret\n```\n\n### Hashicorp's Vault\n\nVia the `FromVault` class. Credentials are read from the backend mounted at `/secret`.\n\n```php\nuse security\\credentials\\{Credentials, FromVault};\n\n// Set token to NULL to use VAULT_TOKEN from environment\n$token= new Secret('72698676-4988-94a4-...');\n\n$credentials= new Credentials(new FromVault('http://127.0.0.1:8200', $token));\n$secret= $credentials-\u003enamed('ldap_password');     // Reads ldap_password key from /secret\n\n$credentials= new Credentials(new FromVault('http://127.0.0.1:8200', $token, 'vendor/name'));\n$secret= $credentials-\u003enamed('mysql');             // Reads mysql key from /secret/vendor/name\n```\n\n### KeePass databases\n\nVia the `KeePass` class.\n\n```php\nuse security\\credentials\\{Credentials, FromKeePass};\nuse util\\Secret;\n\n$secret= new Secret('key');\n\n$credentials= new Credentials(new FromKeePass('database.kdbx', $secret));\n$secret= $credentials-\u003enamed('ldap_password');     // Reads top-level entry ldap_password\n\n$credentials= new Credentials(new FromKeePass('database.kdbx', $secret, 'vendor/name'));\n$secret= $credentials-\u003enamed('mysql');             // Reads mysql entry in vendor/name subfolder\n```\n\n### Docker secrets\n\nSee https://docs.docker.com/engine/swarm/secrets/. Uses Docker's default locations on both Windows and Un\\*x systems if constructed without argument.\n\n```php\nuse security\\credentials\\{Credentials, FromDockerSecrets};\nuse util\\Secret;\n\n$credentials= new Credentials(new FromDockerSecrets());\n$secret= $credentials-\u003enamed('ldap_password');     // Reads top-level entry ldap_password\n```\n\nSee also\n--------\nhttps://github.com/xp-framework/rfc/issues/316","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fcredentials","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxp-forge%2Fcredentials","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxp-forge%2Fcredentials/lists"}