Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
docs: php sdk
Daniel Hougaard5a2058d24aee
diff --git a/docs/docs.json b/docs/docs.jsonindex 336828000c..4ec0e13f2e 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -2448,6 +2448,7 @@"sdks/languages/cpp","sdks/languages/rust","sdks/languages/go",+ "sdks/languages/php","sdks/languages/ruby"]}diff --git a/docs/images/sdks/languages/php.svg b/docs/images/sdks/languages/php.svgnew file mode 100644index 0000000000..37a5e6fe7e--- /dev/null+++ b/docs/images/sdks/languages/php.svg@@ -0,0 +1,96 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<svg height="383.5975" id="svg3430" version="1.1" viewBox="0 0 711.20123 383.5975" width="711.20123" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg">+ <title id="title3510">Official PHP Logo</title>+ <metadata id="metadata3436">+ <rdf:RDF>+ <cc:Work rdf:about="">+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>+ <dc:title>Official PHP Logo</dc:title>+ <dc:creator>+ <cc:Agent>+ <dc:title>Colin Viebrock</dc:title>+ </cc:Agent>+ </dc:creator>+ <dc:description/>+ <dc:contributor>+ <cc:Agent>+ <dc:title/>+ </cc:Agent>+ </dc:contributor>+ <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/"/>+ <dc:rights>+ <cc:Agent>+ <dc:title>Copyright Colin Viebrock 1997 - All rights reserved.</dc:title>+ </cc:Agent>+ </dc:rights>+ <dc:date>1997</dc:date>+ </cc:Work>+ <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">+ <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>+ <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>+ <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>+ <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>+ <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>+ <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/>+ </cc:License>+ </rdf:RDF>+ </metadata>+ <defs id="defs3434">+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath3444">+ <path d="M 11.52,162 C 11.52,81.677 135.307,16.561 288,16.561 l 0,0 c 152.693,0 276.481,65.116 276.481,145.439 l 0,0 c 0,80.322 -123.788,145.439 -276.481,145.439 l 0,0 C 135.307,307.439 11.52,242.322 11.52,162" id="path3446"/>+ </clipPath>+ <radialGradient cx="0" cy="0" fx="0" fy="0" gradientTransform="matrix(363.05789,0,0,-363.05789,177.52002,256.30713)" gradientUnits="userSpaceOnUse" id="radialGradient3452" r="1" spreadMethod="pad">+ <stop id="stop3454" offset="0" style="stop-opacity:1;stop-color:#aeb2d5"/>+ <stop id="stop3456" offset="0.3" style="stop-opacity:1;stop-color:#aeb2d5"/>+ <stop id="stop3458" offset="0.75" style="stop-opacity:1;stop-color:#484c89"/>+ <stop id="stop3460" offset="1" style="stop-opacity:1;stop-color:#484c89"/>+ </radialGradient>+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath3468">+ <path d="M 0,324 576,324 576,0 0,0 0,324 Z" id="path3470"/>+ </clipPath>+ <clipPath clipPathUnits="userSpaceOnUse" id="clipPath3480">+ <path d="M 0,324 576,324 576,0 0,0 0,324 Z" id="path3482"/>+ </clipPath>+ </defs>+ <g id="g3438" transform="matrix(1.25,0,0,-1.25,-4.4,394.29875)">+ <g id="g3440">+ <g clip-path="url(#clipPath3444)" id="g3442">+ <g id="g3448">+ <g id="g3450">+ <path d="M 11.52,162 C 11.52,81.677 135.307,16.561 288,16.561 l 0,0 c 152.693,0 276.481,65.116 276.481,145.439 l 0,0 c 0,80.322 -123.788,145.439 -276.481,145.439 l 0,0 C 135.307,307.439 11.52,242.322 11.52,162" id="path3462" style="fill:url(#radialGradient3452);stroke:none"/>+ </g>+ </g>+ </g>+ </g>+ <g id="g3464">+ <g clip-path="url(#clipPath3468)" id="g3466">+ <g id="g3472" transform="translate(288,27.3594)">+ <path d="M 0,0 C 146.729,0 265.68,60.281 265.68,134.641 265.68,209 146.729,269.282 0,269.282 -146.729,269.282 -265.68,209 -265.68,134.641 -265.68,60.281 -146.729,0 0,0" id="path3474" style="fill:#777bb3;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ </g>+ </g>+ <g id="g3476">+ <g clip-path="url(#clipPath3480)" id="g3478">+ <g id="g3484" transform="translate(161.7344,145.3066)">+ <path d="m 0,0 c 12.065,0 21.072,2.225 26.771,6.611 5.638,4.341 9.532,11.862 11.573,22.353 1.903,9.806 1.178,16.653 -2.154,20.348 C 32.783,53.086 25.417,55 14.297,55 L -4.984,55 -15.673,0 0,0 Z m -63.063,-67.75 c -0.895,0 -1.745,0.4 -2.314,1.092 -0.57,0.691 -0.801,1.601 -0.63,2.48 L -37.679,81.573 C -37.405,82.982 -36.17,84 -34.734,84 L 26.32,84 C 45.508,84 59.79,78.79 68.767,68.513 77.792,58.182 80.579,43.741 77.05,25.592 75.614,18.198 73.144,11.331 69.709,5.183 66.27,-0.972 61.725,-6.667 56.198,-11.747 49.582,-17.939 42.094,-22.429 33.962,-25.071 25.959,-27.678 15.681,-29 3.414,-29 l -24.722,0 -7.06,-36.322 c -0.274,-1.41 -1.508,-2.428 -2.944,-2.428 l -31.751,0 z" id="path3486" style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ <g id="g3488" transform="translate(159.2236,197.3071)">+ <path d="m 0,0 16.808,0 c 13.421,0 18.083,-2.945 19.667,-4.7 2.628,-2.914 3.124,-9.058 1.435,-17.767 C 36.012,-32.217 32.494,-39.13 27.452,-43.012 22.29,-46.986 13.898,-49 2.511,-49 L -9.523,-49 0,0 Z m 28.831,35 -61.055,0 c -2.872,0 -5.341,-2.036 -5.889,-4.855 l -28.328,-145.751 c -0.342,-1.759 0.12,-3.578 1.259,-4.961 1.14,-1.383 2.838,-2.183 4.63,-2.183 l 31.75,0 c 2.873,0 5.342,2.036 5.89,4.855 l 6.588,33.895 22.249,0 c 12.582,0 23.174,1.372 31.479,4.077 8.541,2.775 16.399,7.48 23.354,13.984 5.752,5.292 10.49,11.232 14.08,17.657 3.591,6.427 6.171,13.594 7.668,21.302 3.715,19.104 0.697,34.402 -8.969,45.466 C 63.965,29.444 48.923,35 28.831,35 m -45.633,-90 19.313,0 c 12.801,0 22.336,2.411 28.601,7.234 6.266,4.824 10.492,12.875 12.688,24.157 2.101,10.832 1.144,18.476 -2.871,22.929 C 36.909,3.773 28.87,6 16.808,6 L -4.946,6 -16.802,-55 M 28.831,29 C 47.198,29 60.597,24.18 69.019,14.539 77.44,4.898 79.976,-8.559 76.616,-25.836 75.233,-32.953 72.894,-39.46 69.601,-45.355 66.304,-51.254 61.999,-56.648 56.679,-61.539 50.339,-67.472 43.296,-71.7 35.546,-74.218 27.796,-76.743 17.925,-78 5.925,-78 l -27.196,0 -7.531,-38.75 -31.75,0 28.328,145.75 61.055,0" id="path3490" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ <g id="g3492" transform="translate(311.583,116.3066)">+ <path d="m 0,0 c -0.896,0 -1.745,0.4 -2.314,1.092 -0.571,0.691 -0.802,1.6 -0.631,2.48 L 9.586,68.061 C 10.778,74.194 10.484,78.596 8.759,80.456 7.703,81.593 4.531,83.5 -4.848,83.5 L -27.55,83.5 -43.305,2.428 C -43.579,1.018 -44.814,0 -46.25,0 l -31.5,0 c -0.896,0 -1.745,0.4 -2.315,1.092 -0.57,0.691 -0.801,1.601 -0.63,2.48 l 28.328,145.751 c 0.274,1.409 1.509,2.427 2.945,2.427 l 31.5,0 c 0.896,0 1.745,-0.4 2.315,-1.091 0.57,-0.692 0.801,-1.601 0.63,-2.481 L -21.813,113 2.609,113 c 18.605,0 31.221,-3.28 38.569,-10.028 7.49,-6.884 9.827,-17.891 6.947,-32.719 L 34.945,2.428 C 34.671,1.018 33.437,0 32,0 L 0,0 Z" id="path3494" style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ <g id="g3496" transform="translate(293.6611,271.0571)">+ <path d="m 0,0 -31.5,0 c -2.873,0 -5.342,-2.036 -5.89,-4.855 l -28.328,-145.751 c -0.342,-1.759 0.12,-3.578 1.26,-4.961 1.14,-1.383 2.838,-2.183 4.63,-2.183 l 31.5,0 c 2.872,0 5.342,2.036 5.89,4.855 l 15.283,78.645 20.229,0 c 9.363,0 11.328,-2 11.407,-2.086 0.568,-0.611 1.315,-3.441 0.082,-9.781 l -12.531,-64.489 c -0.342,-1.759 0.12,-3.578 1.26,-4.961 1.14,-1.383 2.838,-2.183 4.63,-2.183 l 32,0 c 2.872,0 5.342,2.036 5.89,4.855 l 13.179,67.825 c 3.093,15.921 0.447,27.864 -7.861,35.5 -7.928,7.281 -21.208,10.82 -40.599,10.82 l -20.784,0 6.143,31.605 C 6.231,-5.386 5.77,-3.566 4.63,-2.184 3.49,-0.801 1.792,0 0,0 m 0,-6 -7.531,-38.75 28.062,0 c 17.657,0 29.836,-3.082 36.539,-9.238 6.703,-6.16 8.711,-16.141 6.032,-29.938 l -13.18,-67.824 -32,0 12.531,64.488 c 1.426,7.336 0.902,12.34 -1.574,15.008 -2.477,2.668 -7.746,4.004 -15.805,4.004 l -25.176,0 -16.226,-83.5 -31.5,0 L -31.5,-6 0,-6" id="path3498" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ <g id="g3500" transform="translate(409.5498,145.3066)">+ <path d="m 0,0 c 12.065,0 21.072,2.225 26.771,6.611 5.638,4.34 9.532,11.861 11.574,22.353 1.903,9.806 1.178,16.653 -2.155,20.348 C 32.783,53.086 25.417,55 14.297,55 L -4.984,55 -15.673,0 0,0 Z m -63.062,-67.75 c -0.895,0 -1.745,0.4 -2.314,1.092 -0.57,0.691 -0.802,1.601 -0.631,2.48 L -37.679,81.573 C -37.404,82.982 -36.17,84 -34.733,84 L 26.32,84 C 45.509,84 59.79,78.79 68.768,68.513 77.793,58.183 80.579,43.742 77.051,25.592 75.613,18.198 73.144,11.331 69.709,5.183 66.27,-0.972 61.725,-6.667 56.198,-11.747 49.582,-17.939 42.094,-22.429 33.962,-25.071 25.959,-27.678 15.681,-29 3.414,-29 l -24.723,0 -7.057,-36.322 c -0.275,-1.41 -1.509,-2.428 -2.946,-2.428 l -31.75,0 z" id="path3502" style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ <g id="g3504" transform="translate(407.0391,197.3071)">+ <path d="M 0,0 16.808,0 C 30.229,0 34.891,-2.945 36.475,-4.7 39.104,-7.614 39.6,-13.758 37.91,-22.466 36.012,-32.217 32.493,-39.13 27.452,-43.012 22.29,-46.986 13.898,-49 2.511,-49 L -9.522,-49 0,0 Z m 28.831,35 -61.054,0 c -2.872,0 -5.341,-2.036 -5.889,-4.855 L -66.44,-115.606 c -0.342,-1.759 0.12,-3.578 1.259,-4.961 1.14,-1.383 2.838,-2.183 4.63,-2.183 l 31.75,0 c 2.872,0 5.342,2.036 5.89,4.855 l 6.587,33.895 22.249,0 c 12.582,0 23.174,1.372 31.479,4.077 8.541,2.775 16.401,7.481 23.356,13.986 5.752,5.291 10.488,11.23 14.078,17.655 3.591,6.427 6.171,13.594 7.668,21.302 3.715,19.105 0.697,34.403 -8.969,45.467 C 63.965,29.444 48.924,35 28.831,35 m -45.632,-90 19.312,0 c 12.801,0 22.336,2.411 28.601,7.234 6.267,4.824 10.492,12.875 12.688,24.157 2.102,10.832 1.145,18.476 -2.871,22.929 C 36.909,3.773 28.87,6 16.808,6 L -4.946,6 -16.801,-55 M 28.831,29 C 47.198,29 60.597,24.18 69.019,14.539 77.441,4.898 79.976,-8.559 76.616,-25.836 75.233,-32.953 72.894,-39.46 69.601,-45.355 66.304,-51.254 61.999,-56.648 56.679,-61.539 50.339,-67.472 43.296,-71.7 35.546,-74.218 27.796,-76.743 17.925,-78 5.925,-78 l -27.196,0 -7.53,-38.75 -31.75,0 28.328,145.75 61.054,0" id="path3506" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"/>+ </g>+ </g>+ </g>+ </g>+</svg>\ No newline at end of filediff --git a/docs/sdks/languages/php.mdx b/docs/sdks/languages/php.mdxnew file mode 100644index 0000000000..3337f22384--- /dev/null+++ b/docs/sdks/languages/php.mdx@@ -0,0 +1,204 @@+---+title: "Infisical PHP SDK"+sidebarTitle: "PHP"+icon: "/images/sdks/languages/php.svg"+---++If you're working with PHP, the official Infisical PHP SDK package is the easiest way to fetch and work with secrets for your application.++## Installation++```bash+composer require infisical/php-sdk+```++## Getting Started++```php+<?php++use Infisical\SDK\InfisicalSDK;++$sdk = new InfisicalSDK('http://localhost:8080');++// Authenticate with Infisical+$response = $sdk->auth()->universal_auth()->login(+ "your-machine-identity-client-id",+ "your-machine-identity-client-secret"+);++// List secrets+$params = new \Infisical\SDK\Models\ListSecretsParameters(+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id"+);++$secrets = $sdk->secrets()->list($params);+echo "Fetched secrets: " . count($secrets) . "\n";+```++## Core Methods++The SDK methods are organized into the following high-level categories:++1. `auth`: Handles authentication methods.+2. `secrets`: Manages CRUD operations for secrets.++### `auth`++The `auth` component provides methods for authentication:++#### Universal Auth++**Authenticating**+```php+$response = $sdk->auth()->universal_auth()->login(+ "your-machine-identity-client-id",+ "your-machine-identity-client-secret"+);+```++**Parameters:**+- `clientId` (string): The client ID of your Machine Identity.+- `clientSecret` (string): The client secret of your Machine Identity.++<Warning>+ We do not recommend hardcoding your [Machine Identity Tokens](/platform/identities/overview). Setting them as environment variables would be best.+</Warning>++### `secrets`++This sub-class handles operations related to secrets:++#### List Secrets++```php+use Infisical\SDK\Models\ListSecretsParameters;++$params = new ListSecretsParameters(+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id",+ tagSlugs: ["tag1", "tag2"], // Optional+ recursive: true, // Optional+ expandSecretReferences: true, // Optional+ attach_to_process_env: false, // Optional+ skipUniqueValidation: false // Optional+);++$secrets = $sdk->secrets()->list($params);+```++**Parameters:**+- `environment` (string): The environment in which to list secrets (e.g., "dev").+- `projectId` (string): The ID of your project.+- `secretPath` (string, optional): The path to the secrets.+- `tagSlugs` (array, optional): Tags to filter secrets.+- `recursive` (bool, optional): Whether to list secrets recursively.+- `expandSecretReferences` (bool, optional): Whether to expand secret references.+- `attach_to_process_env` (bool, optional): Whether to attach secrets to process environment variables.+- `skipUniqueValidation` (bool, optional): Whether to skip unique validation.++**Returns:**+- `Secret[]`: An array of secret objects.++#### Create Secret++```php+use Infisical\SDK\Models\CreateSecretParameters;++$params = new CreateSecretParameters(+ secretKey: "SECRET_NAME",+ secretValue: "SECRET_VALUE",+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id"+);++$createdSecret = $sdk->secrets()->create($params);+```++**Parameters:**+- `secretKey` (string): The name of the secret to create.+- `secretValue` (string): The value of the secret.+- `environment` (string): The environment in which to create the secret.+- `projectId` (string): The ID of your project.+- `secretPath` (string, optional): The path to the secret.++**Returns:**+- `Secret`: The created secret object.++#### Get Secret++```php+use Infisical\SDK\Models\GetSecretParameters;++$params = new GetSecretParameters(+ secretKey: "SECRET_NAME",+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id"+);++$secret = $sdk->secrets()->get($params);+```++**Parameters:**+- `secretKey` (string): The name of the secret to retrieve.+- `environment` (string): The environment in which to retrieve the secret.+- `projectId` (string): The ID of your project.+- `secretPath` (string, optional): The path to the secret.++**Returns:**+- `Secret`: The retrieved secret object.++#### Update Secret++```php+use Infisical\SDK\Models\UpdateSecretParameters;++$params = new UpdateSecretParameters(+ secretKey: "SECRET_NAME",+ newSecretValue: "UPDATED_SECRET_VALUE",+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id"+);++$updatedSecret = $sdk->secrets()->update($params);+```++**Parameters:**+- `secretKey` (string): The name of the secret to update.+- `newSecretValue` (string): The new value of the secret.+- `environment` (string): The environment in which to update the secret.+- `projectId` (string): The ID of your project.+- `secretPath` (string, optional): The path to the secret.++**Returns:**+- `Secret`: The updated secret object.++#### Delete Secret++```php+use Infisical\SDK\Models\DeleteSecretParameters;++$params = new DeleteSecretParameters(+ secretKey: "SECRET_NAME",+ environment: "dev",+ secretPath: "/",+ projectId: "your-project-id"+);++$deletedSecret = $sdk->secrets()->delete($params);+```++**Parameters:**+- `secretKey` (string): The name of the secret to delete.+- `environment` (string): The environment in which to delete the secret.+- `projectId` (string): The ID of your project.+- `secretPath` (string, optional): The path to the secret.++**Returns:**+- `Secret`: The deleted secret object.\ No newline at end of filediff --git a/docs/sdks/overview.mdx b/docs/sdks/overview.mdxindex 0b69491087..f9a8fcac30 100644--- a/docs/sdks/overview.mdx+++ b/docs/sdks/overview.mdx@@ -32,6 +32,9 @@ From local development to production, Infisical SDKs provide the easiest way for</Card><Card href="/sdks/languages/go" title="Go" icon="/images/sdks/languages/go.svg">Manage secrets for your Go application on demand+ </Card>+ <Card href="/sdks/languages/php" title="PHP" icon="/images/sdks/languages/php.svg">+ Manage secrets for your PHP application on demand</Card><Card href="/sdks/languages/ruby" title="Ruby" icon="/images/sdks/languages/ruby.svg">Manage secrets for your Ruby application on demand