php-modelslisted
Install: claude install-skill MuHamza30/paypal-api-plugin
# Working with models in an APIMatic PHP SDK
Models are plain PHP classes in `src/Models/`: private fields, a constructor taking the **required**
fields, `get{Field}()` / `set{Field}()` pairs, and `jsonSerialize()`. Beside each one, in
`src/Models/Builders/`, is a `{Model}Builder`. This skill covers the shapes that trip integrations up;
the plain scalar case is in **php-calling-endpoints**.
## Building: the builder's `init(...)` is the required-field list
```php
use PaypalServerSdkLib\Models\Builders\{Model}Builder;
$model = {Model}Builder::init(/* required fields, positionally */)
->{optionalField}($value)
->build();
```
`build()` returns a **clone**, so a builder can be reused. `new {Model}(...)` plus `set{Field}(...)` is
the equivalent longhand.
## PHP name vs JSON name
The setter's docblock carries `@maps {jsonName}` — that, not the method name, is the wire field. They
diverge whenever the JSON name collides with a PHP keyword or an inherited member, so a JSON `code`
field can surface as `getCodeProperty()` / `setCodeProperty()`. When you need the wire name, read the
`@maps` annotation (or the model's `jsonSerialize()`), not the getter.
## Enums — a class of constants, not a PHP `enum`
These SDKs target PHP 7.2+, so an enum is generated as a **plain class** holding `public const` values.
Whether that class *also* carries a static `checkValue()` validator, and whether any setter names it, is
what varies:
```php
use PaypalServerSdkLib\Models\{EnumClass};