> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI4YzkwY2JkYi01ZDE3LTQ2NDQtYTJmYS0zNGVlN2JhMzkzNDUiLCJleHAiOjE3Nzg0MTk2MjIsImlhdCI6MTc3ODQxOTMyMn0.kF4i5SZZZyrA3XPEsdaagcPEiMpHdK3DmvANU4Y5MIg
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# PHP 配置

> 使用 Fern 配置您的 PHP SDK 生成器。自定义客户端名称、命名空间、包设置和 composer.json，用于 PHP 客户端库。

您可以在 `generators.yml` 中自定义 PHP SDK 生成器的行为：

```yaml {7-8} title="generators.yml"
groups:
  php-sdk:
    generators:
      - name: fernapi/fern-php
        version: 2.8.1
        config:
          clientName: YourClientName
```

## SDK 配置选项

<ParamField path="clientName" type="string" required={false} toc={true}>
  设置生成的 API 客户端类的名称。这决定了用户在生成的 PHP SDK 中与之交互的主要客户端类型名称。
</ParamField>

<ParamField path="composerJson" type="Record<string, any>" required={false} toc={true}>
  允许自定义生成的 `composer.json` 文件内容。您可以指定额外的元数据、依赖项或配置，这些将合并到包的 composer 配置文件中。
</ParamField>

<ParamField path="enable-wire-tests" type="boolean" default="false" required={false} toc={true}>
  启用时，生成[模拟服务器（wire）测试](/sdks/deep-dives/testing#mock-server-tests)来验证 SDK 是否按预期发送和接收 HTTP 请求。
</ParamField>

<ParamField path="inlinePathParameters" type="boolean" required={false} toc={true}>
  启用时，路径参数作为请求类中的属性包含，而不是作为单独的方法参数传递。这创建了一个更统一的请求结构，其中所有参数都在请求对象中分组。
</ParamField>

<ParamField path="namespace" type="string" required={false} toc={true}>
  指定所有生成代码的 PHP 命名空间。这决定了用户在导入和使用 SDK 类时将使用的命名空间层次结构。
</ParamField>

<ParamField path="packageName" type="string" required={false} toc={true}>
  设置 PHP 包的名称，该名称将出现在 Composer 和 Packagist 中。这是用户通过 Composer 安装 SDK 时将使用的名称（例如，`composer require your/package-name`）。
</ParamField>

<ParamField path="packagePath" type="string" required={false} toc={true}>
  指定生成的 SDK 源文件应放置的目录路径。这决定了生成的 PHP 代码相对于输出目录的文件系统位置。
</ParamField>

<ParamField path="propertyAccess" type="'public' | 'private'" required={false} toc={true}>
  控制生成的类属性的访问级别。设置为 'public' 时，属性是公共的且省略 getter/setter 方法。设置为 'private' 时，属性是私有的且为封装生成 getter/setter 方法。
</ParamField>