PHPackages                             andy87/php-client-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. andy87/php-client-sdk

ActiveLibrary[API Development](/categories/api)

andy87/php-client-sdk
=====================

Base abstractions for typed PHP API clients.

v0.7.0(4w ago)01352MITPHPPHP &gt;=8.1

Since May 10Pushed 4w agoCompare

[ Source](https://github.com/andy87/php-client-sdk)[ Packagist](https://packagist.org/packages/andy87/php-client-sdk)[ RSS](/packages/andy87-php-client-sdk/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (6)Used By (2)

PHP Client SDK
==============

[](#php-client-sdk)

Base abstractions for building typed PHP API clients.

[Russian documentation](docs/ru/README.md)

Overview
--------

[](#overview)

`andy87/php-client-sdk` provides a small set of reusable building blocks for API client SDKs:

- prompt DTOs for request method, endpoint, path parameters, query parameters, body and validation;
- response DTOs for normalized response data, status code, headers and API errors;
- provider base class for executing typed API methods;
- pluggable authorization strategies;
- pluggable HTTP transport with a native PHP stream implementation.

The package does not generate API clients and does not depend on a specific HTTP client library.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher.
- Composer.

Installation
------------

[](#installation)

```
composer require andy87/php-client-sdk
```

Core Concepts
-------------

[](#core-concepts)

The package separates an API call into three parts:

- `PromptInterface` describes an outgoing request.
- `ResponseInterface` describes a typed API response.
- `AbstractProvider` connects prompts, responses, authorization and HTTP transport.

`NativeHttpTransport` can be used without extra dependencies. If a project needs another transport, implement `HttpTransportInterface`.

Prompt DTO
----------

[](#prompt-dto)

Extend `AbstractPrompt` to describe a request. The base class hydrates declared properties from input data, validates required fields, builds path/query/body arrays and normalizes nested DTO values through `toArray()` or `toValue()` when those methods exist.

Use `PublicPrompt` for public endpoints and `PrivatePrompt` for private endpoints with an authorization profile. `AbstractPrompt` remains the generic base class for custom prompt schemes.

```
