1.16.2

(feat): Add documentation for retries and timeout parameters in the README, including examples of how to configure maxRetries and timeout options at the request level

1.16.1

(feat): Add exception handling documentation to README with examples of catching and handling API exceptions

1.16.0

(feat): Introduce initial version of README generation for the PHP SDK with Installation, Usage, and Contributing sections.

1.15.1

(internal): Update the IR to v58.

0.14.2

(fix): This updates the PHP generator to better support undiscriminated unions that define one or more optional types. With this, the generator unwraps each of the optional types, and includes a |null variant (e.g. array<string, mixed>|Metadata|null).

0.14.0

(feat): Support literal types

0.13.7

(fix): Make constructor private for union types and remove static unknown constructor

0.13.6

(fix): Fix an issue where the value field of the deserialized discriminated union was null.

0.13.5

(fix): Change discriminated union method name from ->getvalue() to ->getValue().

0.13.4

(fix): Flatten test directory structure from tests/package-name/** to tests/** so it matches the psr-4 structure defined in composer.json. Without this change, you cannot reference classes within the tests directory from your tests, for example, a Helpers class for common test utilities.

0.13.3

(fix): Fix issue where an empty request would be JSON serialized as an empty array instead of an empty object.

0.13.2

(fix): Fix a bug where literal global headers could not be overridden in the root client constructor.

0.13.1

(fix): Render union references as their type references rather than mixed.

0.13.0

(feat): Add support for configuring a request timeout.

(fix): Fix a bug where the private pagination method helpers collided with magic methods (e.g. __get).

0.12.0

(feat): Add support for discriminated unions.

0.11.0

(feat): The SDK now supports a bodyProperties and queryParameters request option, which can be used to add arbitrary properties to the request. This is useful for interacting with alpha or undocumented functionality.

$response = $client->users->list(
1 new ListUsersRequest([
2 ...
3 ]),
4 [
5 'queryParameters' => [
6 'limit' => 100,
7 ],
8 ]
9); ```

0.10.0

(feat): You can now modify the generated composer.json file by adding a composerJson property to your generator configuration. Here’s an example of the generators.yml file with the composerJson property:

generators.yml ... groups:
1 php-sdk:
2 generators:
3 - name: fernapi/fern-php-sdk
4 ...
5 config:
6 composerJson:
7 description: This is my PHP library
8 keywords:
9 - myCustomTag
10 license:
11 - "LGPL-2.1-only"
12 - "GPL-3.0-or-later"
13 scripts:
14 hello: echo hello

Which will result in the following composer.json file:

composer.json {
1 // ...,
2 "description": "This is my PHP library",
3 "keywords": [
4 "myCustomTag",
5 // ...,
6 ],
7 "license": [
8 "LGPL-2.1-only",
9 "GPL-3.0-or-later"
10 ],
11 // ...,
12 "scripts": {
13 // ...,
14 "hello": "echo hello"
15 }
16} ```
17
18## 0.9.0
19**`(feat):`** Add the ability to access alpha or undocumented response properties from every class. Users can access the additional properties like so:
20```php $response = $client->users->get(...); $additionalProperties = $response->getAdditionalProperties(); ```
21
22## 0.8.0
23**`(feat):`** Add automatic pagination support for endpoints that return a paginated response.
24Here's an example of how users can use paginated endpoints:
25```php $items = $client->list($request); foreach($items as $item){
26 echo $item;
27} $pages = $items->getPages(); foreach($pages as $page){
28 foreach($page as $item){
29 echo $item;
30 }
31} ```

0.7.0

(feat): The SDK now supports inline path parameters in the generated request class like so:

class GetUserRequest extends JsonSerializableType {
1 /**
2 * @var string $userId
3 */
4 public string $userId;
5} ```
6You can configure this in your `generators.yml` like so:
7```yaml - name: fernapi/fern-php-sdk
8 version: 0.7.0
9 config:
10 inlinePathParameters: true

0.6.0

(feat): You can now configure the generated class property access to be public or private.

  • When the access is public, both the getter and setter methods are omitted (default).
  • When the access is private, both the getter and setter methods are generated.

You can configure this in your generators.yml like so:

- name: fernapi/fern-php-sdk
1 version: 0.6.0
2 config:
3 propertyAccess: private

0.5.2

(fix): Update the endpoint generator to not require the in-lined request wrapper if it’s only composed of optional properties.

(fix): Update optional query parameters lists to be generated as an optional array instead of an array of optional values.

0.5.1

(fix): Catch HTTP request exceptions and rethrow it as a FooApiException.

0.5.0

(feat): Add the __toString() magic method to all generated class types.

0.4.0

(feat): Retry HTTP requests on status codes 408, 429, 5XX. You can configure the maximum number of retries like this: php $client = new FooClient("token", ['maxRetries' => 3]) $client->bar($request, ['maxRetries' => 5]); The default for maxRetries is 2, meaning up to 3 HTTP requests may be sent. Set maxRetries to 0 to disable retries. If you create your own HTTP client and pass it to the root client, you must add the desired middlewares yourself. Here’s how you would add the RetryMiddleware to a custom HTTP client: php $handlerStack = HandlerStack::create(); $handlerStack->push(RetryMiddleware::create()); $httpClient = new Client(['handler' => $handlerStack]); $client = new FooClient(['client' => $client]);

0.3.2

(internal): Upgrade to IRv55 to recognize nullable types.

0.3.1

(fix): Improve multiline parameter docs by writing them above the tag, e.g.

class UpdateUserRequest extends JsonSerializableType {
1 /**
2 * The user to update.
3 *
4 * See [User](https://acme.co/user) for more information.
5 *
6 * @var ?User $user
7 */
8 public ?User $user;
9} ```
10
11**`(fix):`** Add .idea to the generated .gitignore file.