PHPackages                             openapi/openapi-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. [HTTP &amp; Networking](/categories/http)
4. /
5. openapi/openapi-sdk

ActiveLibrary[HTTP &amp; Networking](/categories/http)

openapi/openapi-sdk
===================

Minimal and agnostic PHP SDK for Openapi® (https://openapi.com)

1.2.1(5mo ago)6120↓100%1[10 issues](https://github.com/openapi/openapi-php-sdk/issues)1MITPHPPHP &gt;=8.0.0CI passing

Since Sep 29Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/openapi/openapi-php-sdk)[ Packagist](https://packagist.org/packages/openapi/openapi-sdk)[ RSS](/packages/openapi-openapi-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (13)Used By (1)

 [ ![Openapi SDK for PHP](.github/assets/repo-header-a3.png) ](https://openapi.com/)Openapi® client for PHP
=======================

[](#openapi-client-for-php)

#### The perfect starting point to integrate [Openapi®](https://openapi.com/) within your PHP project

[](#the-perfect-starting-point-to-integrate-openapi-within-your-php-project)

[![Build Status](https://github.com/openapi/openapi-php-sdk/actions/workflows/php.yml/badge.svg)](https://github.com/openapi/openapi-php-sdk/actions/workflows/php.yml)[![Packagist Version](https://camo.githubusercontent.com/004c21fde25388c8b771476eb79433406be36d3cebfb6012396627dd14858f38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e6170692f6f70656e6170692d73646b)](https://packagist.org/packages/openapi/openapi-sdk)[![PHP Version](https://camo.githubusercontent.com/bbc401e01fccfb7b31d4f068e97c2d6ca9219db1be691c1f8fd9caafb5e4c3ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f70656e6170692f6f70656e6170692d73646b)](https://packagist.org/packages/openapi/openapi-sdk)[![License](https://camo.githubusercontent.com/33fda1d673c1e12010a238ff78995598e09c063529b9e8ad3eef42c80be005d8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f70656e6170692f6f70656e6170692d7068702d73646b3f763d32)](LICENSE)[![Downloads](https://camo.githubusercontent.com/0abae9be4c6ddc94b6fdab016b688617a7223061ca0c73e5a59f57d761d51831/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e6170692f6f70656e6170692d73646b)](https://packagist.org/packages/openapi/openapi-sdk)
[![Linux Foundation Member](https://camo.githubusercontent.com/a9877e65c528205a5aea985180bb46c28cf61c2b2edc99b078351e4564082499/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e7578253230466f756e646174696f6e2d53696c7665722532304d656d6265722d3030333737383f6c6f676f3d6c696e75782d666f756e646174696f6e266c6f676f436f6c6f723d7768697465)](https://www.linuxfoundation.org/about/members)

Overview
--------

[](#overview)

A minimal and agnostic PHP SDK for Openapi, inspired by a clean client implementation. This SDK provides only the core HTTP primitives needed to interact with any Openapi service.

Pre-requisites
--------------

[](#pre-requisites)

Before using the Openapi PHP Client, you will need an account at [Openapi](https://console.openapi.com/) and an API key to the sandbox and/or production environment

Features
--------

[](#features)

- **Agnostic Design**: No API-specific classes, works with any OpenAPI service
- **Minimal Dependencies**: Only requires PHP 8.0+ and cURL
- **OAuth Support**: Built-in OAuth client for token management
- **HTTP Primitives**: GET, POST, PUT, DELETE, PATCH methods
- **Clean Interface**: Similar to the Rust SDK design

What you can do
---------------

[](#what-you-can-do)

With the Openapi PHP Client, you can easily interact with a variety of services in the Openapi Marketplace. For example, you can:

- 📩 **Send SMS messages** with delivery reports and custom sender IDs
- 💸 **Process bills and payments** in real time via API
- 🧾 **Send electronic invoices** securely to the Italian Revenue Agency
- 📄 **Generate PDFs** from HTML content, including JavaScript rendering
- ✉️ **Manage certified emails** and legal communications via Italian Legalmail

For a complete list of all available services, check out the [Openapi Marketplace](https://console.openapi.com/) 🌐

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

[](#installation)

You can add the Openapi PHP Client to your project with the following command:

```
composer require openapi/openapi-sdk
```

Quick Start
-----------

[](#quick-start)

### Token Generation

[](#token-generation)

```
use OpenApi\OauthClient;

$oauthClient = new OauthClient('username', 'apikey', true); // true for test environment

$scopes = [
    'GET:test.imprese.openapi.it/advance',
    'POST:test.postontarget.com/fields/country'
];

$result = $oauthClient->createToken($scopes, 3600);
$tokenData = json_decode($result, true);
$token = $tokenData['token'];
```

### Making API Calls

[](#making-api-calls)

```
use OpenApi\Client;

$client = new Client($token);

// GET request
$params = ['denominazione' => 'Stellantis', 'provincia' => 'TO'];
$response = $client->get('https://test.company.openapi.com/IT-advanced', $params);

// POST request
$payload = ['limit' => 10, 'query' => ['country_code' => 'IT']];
$response = $client->post('https://test.postontarget.com/fields/country', $payload);

// Other HTTP methods
$response = $client->put($url, $payload);
$response = $client->delete($url);
$response = $client->patch($url, $payload);
```

Architecture
------------

[](#architecture)

This SDK follows a minimal approach with only essential components:

- `OauthClient`: Handles OAuth authentication and token management
- `Client`: Agnostic HTTP client for API calls
- `Exception`: Error handling
- `Cache\CacheInterface`: Optional caching interface

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

[](#requirements)

- PHP 8.0 or higher
- cURL extension
- JSON extension

Examples
--------

[](#examples)

You can find complete examples in the `examples/` directory:

- `examples/token_generation.php` - OAuth token generation example
- `examples/api_calls.php` - HTTP API calls example
- `examples/complete_workflow.php` - End-to-end workflow example

Run examples with:

```
composer run example:token
composer run example:api
composer run example:complete
```

Testing
-------

[](#testing)

Run tests with:

```
# Run all tests
composer run test

# Run unit tests specifically
composer run test:unit
```

Contributing
------------

[](#contributing)

Contributions are always welcome! Whether you want to report bugs, suggest new features, improve documentation, or contribute code, your help is appreciated.

See [docs/contributing.md](docs/contributing.md) for detailed instructions on how to get started. Please make sure to follow this project's [docs/code-of-conduct.md](docs/code-of-conduct.md) to help maintain a welcoming and collaborative environment.

Authors
-------

[](#authors)

Meet the project authors:

- L. Paderi ([@lpaderiAltravia](https://www.github.com/lpaderiAltravia))
- Openapi Team ([@openapi-it](https://github.com/openapi-it))

Partners
--------

[](#partners)

Meet our partners using Openapi or contributing to this SDK:

- [Blank](https://www.blank.app/)
- [Credit Safe](https://www.creditsafe.com/)
- [Deliveroo](https://deliveroo.it/)
- [Gruppo MOL](https://molgroupitaly.it/it/)
- [Jakala](https://www.jakala.com/)
- [Octotelematics](https://www.octotelematics.com/)
- [OTOQI](https://otoqi.com/)
- [PWC](https://www.pwc.com/)
- [QOMODO S.R.L.](https://www.qomodo.me/)
- [SOUNDREEF S.P.A.](https://www.soundreef.com/)

Our Commitments
---------------

[](#our-commitments)

We believe in open source and we act on that belief. We became Silver Members of the Linux Foundation because we wanted to formally support the ecosystem we build on every day. Open standards, open collaboration, and open governance are part of how we work and how we think about software.

License
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

The MIT License is a permissive open-source license that allows you to freely use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the software, provided that the original copyright notice and this permission notice are included in all copies or substantial portions of the software.

In short, you are free to use this SDK in your personal, academic, or commercial projects, with minimal restrictions. The project is provided "as-is", without any warranty of any kind, either expressed or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.

For more details, see the full license text at the [MIT License page](https://choosealicense.com/licenses/mit/).

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance61

Regular maintenance activity

Popularity19

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~237 days

Recently: every ~443 days

Total

9

Last Release

160d ago

Major Versions

v0.9.0 → v1.0.02020-09-29

PHP version history (2 changes)v0.9.0PHP &gt;=7.2.0

1.2.1PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/bfcf9cbb771639cb55ace06465f23a78b09ae6cd4bf662dd7830b771458659ca?d=identicon)[francescobianco](/maintainers/francescobianco)

---

Top Contributors

[![francescobianco](https://avatars.githubusercontent.com/u/472171?v=4)](https://github.com/francescobianco "francescobianco (36 commits)")[![lpaderiAltravia](https://avatars.githubusercontent.com/u/85158884?v=4)](https://github.com/lpaderiAltravia "lpaderiAltravia (24 commits)")[![pberanrdiniAltravia](https://avatars.githubusercontent.com/u/68341384?v=4)](https://github.com/pberanrdiniAltravia "pberanrdiniAltravia (19 commits)")[![pberanrdini](https://avatars.githubusercontent.com/u/99032905?v=4)](https://github.com/pberanrdini "pberanrdini (5 commits)")[![SimoneOpenapi](https://avatars.githubusercontent.com/u/138789490?v=4)](https://github.com/SimoneOpenapi "SimoneOpenapi (3 commits)")[![mijorus](https://avatars.githubusercontent.com/u/39067225?v=4)](https://github.com/mijorus "mijorus (1 commits)")[![SimoneDesantisAltravia](https://avatars.githubusercontent.com/u/67371387?v=4)](https://github.com/SimoneDesantisAltravia "SimoneDesantisAltravia (1 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (1 commits)")

---

Tags

api-clientapi-marketplacecertified-apicurllaravelopenapiphpphp-sdkrest-apisymfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/openapi-openapi-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/openapi-openapi-sdk/health.svg)](https://phpackages.com/packages/openapi-openapi-sdk)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
