Anthropic SDK for PHP 0.45.0
Last reviewed Sep 25, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- Anthropic SDK for PHP 0.45.080 lines · 3.7K tokens
Total225 lines · 9.1K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 98
- 117
- 187
- 201
- 208
- 209
- 214
- 250
- 256
- 295
- 323
- 338
- 340
- 347
- 352
- 354
- 367
- 384
- 390
- 404
- 409
- 434
- 470
- 488
- 502
- 522
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 675
- 732
- 770
- 776
- 798
- 807
- 829
- 862
- 915
- 916
- 918
- 940
- 1004
- 1050
- 1275
- 1333
- 1395
- 1426
- 1427
Prompt Preview
Apply the PHP 8.5 baseline first. These rules cover anthropic-ai/sdk 0.45.0 on PHP 8.5, including optional beta helpers. The package accepts PHP ^8.1; that dependency constraint does not establish runtime security support.
Client and credential boundaries
- Construct
Anthropic\Clientin trusted server code with a nonempty, validatedapiKeyorauthToken, or an explicitly selected credential provider. Fail deployment when the intended credential is missing; an otherwise unconfigured base client can discover profile or workload-identity credentials. - Select the authentication mode deliberately:
apiKeyandauthTokenindependently inheritANTHROPIC_API_KEYandANTHROPIC_AUTH_TOKEN, and both headers can be sent. Clear or explicitly suppress the unused source instead of inheriting an unrelated identity. - Protect
ANTHROPIC_PROFILE,ANTHROPIC_CONFIG_DIR, profile files, identity-token files, and OAuth refresh credentials when using discovery. Restrict file access yourself; the profile loader's permission warning does not prevent loading. Close credential-backed clients withclose()when their lifecycle ends. - Pin
baseUrlto an approved HTTPS origin. ControlANTHROPIC_BASE_URL, profilebase_url, andANTHROPIC_CUSTOM_HEADERSas privileged deployment settings; keep caller input out of endpoint, proxy, transport, and factory selection. - Use workspace-scoped credentials and separate clients where tenants or workloads require isolation. Derive any
anthropic-workspace-idheader from authorized server-side state; federated credentials select