Anthropic SDK for PHP 0.45.0

Last reviewed Sep 25, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. PHP 8.5145 lines · 5.4K tokens
  2. 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\Client in trusted server code with a nonempty, validated apiKey or authToken, 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: apiKey and authToken independently inherit ANTHROPIC_API_KEY and ANTHROPIC_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 with close() when their lifecycle ends.
  • Pin baseUrl to an approved HTTPS origin. Control ANTHROPIC_BASE_URL, profile base_url, and ANTHROPIC_CUSTOM_HEADERS as 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-id header from authorized server-side state; federated credentials select