PHPackages                             miniapi/miniapi - 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. miniapi/miniapi

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

miniapi/miniapi
===============

This Bundle provides everything you need to interact with web API. It's object-oriented, simple and powerful.

1.0.0(12y ago)137MITPHPPHP &gt;=5.3.0

Since Mar 27Pushed 12y ago1 watchersCompare

[ Source](https://github.com/lyroyce/MiniApi)[ Packagist](https://packagist.org/packages/miniapi/miniapi)[ Docs](https://github.com/lyroyce/MiniApi)[ RSS](/packages/miniapi-miniapi/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

MiniApi
=======

[](#miniapi)

MiniApi is an object oriented and flexible API client which contains everything you need to interact with web API.

Features
--------

[](#features)

- Support standard HTTP protocols: GET, POST, PUT, DELETE, HEAD, OPTIONS;
- Support SOAP protocol
- Support WSSE authentication

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

[](#installation)

```
composer require miniapi/miniapi

```

Get Started
-----------

[](#get-started)

- Initialization

    ```
      $api = new MiniApi\MiniApi();

    ```
- Simple GET request

    ```
      $api->get('http://www.google.com')->call()->debug();

    ```
- Simple POST request

    ```
      $api->post('http://www.google.com/user')->call('{"name", "John"}')->debug();

    ```
- POST with WSSE authentication

    ```
      $response = $api->post('http://www.google.com', '/user')
      	->header('Content-Type','application/json')
      	->auth('WSSE')
      	->prop('wsse.username', 'example-username')
      	->prop('wsse.password', 'example-password')
      	->call('{"name":"John"}');
      echo $response->body();

    ```
- SOAP with WSSE authentication

    ```
      $response = $api->soap('http://www.google.com/?wsdl', 'User.New')
      	->auth('WSSE')
      	->prop('wsse.namespace', 'http://www.google.com')
      	->prop('wsse.username', 'example-username')
      	->prop('wsse.password', 'example-password')
      	->call(array("name"=>"John"));
      echo $response->body();

    ```

For more code examples, please refer to [examples](examples).

Interface
---------

[](#interface)

ProtocolInterfaceGET`$api->get($endpoint, $method='')`POST`$api->post($endpoint, $method='')`PUT`$api->put($endpoint, $method='')`DELETE`$api->delete($endpoint, $method='')`HEAD`$api->head($endpoint, $method='')`OPTIONS`$api->options($endpoint, $method='')`SOAP`$api->soap($endpoint, $method)`User-defined`$api->request($endpoint, $method, $protocol)`Each interface above returns a instance of `MiniRequest` which allows you to do customization using chaining methods, as you already see.

The request will NOT be sent until you use `$api->call()` method which accepts an optional body and returns a instance of `MiniResponse`.

Response Handling
-----------------

[](#response-handling)

`MiniResponse` contains all detailed information about this API call. Below is an example of response handling.

```
if($response->error()){
	echo sprintf("Error: %d %s\n%s",
		$response->status_code(),
		$response->error(),
		$response->response_raw());
}else{
	echo sprintf("Response: %s\n%s\n%s",
		$response->body(),
		$response->request_raw(),
		$response->response_raw());
}

```

To save your time, you can also simply use `echo $response->debug()` to print out detailed request and response.

Need More Protocols/Authentications?
------------------------------------

[](#need-more-protocolsauthentications)

If you need to use some protocol/authentication that MiniApi currently doesn't support, you can write and register your own protocol handler to extend MiniApi.

```
class MySoapClient extends MiniProtocol{
	protected function init_auth_registration(){}
	protected function send(MiniRequest $request, MiniResponse $response){
		echo "MySoapClient is sending request ...\n";
	}
}
$api->register_protocol('SOAP', 'MySoapClient');
$api->request('http://www.google.com/?wsdl', 'User.New', 'SOAP')->call('{"name":"John"}');

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

4432d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8aba8bf8815826b16de9e953a10e0b7744490eed5e673c7d030c851c946ce2f4?d=identicon)[lyroyce](/maintainers/lyroyce)

---

Top Contributors

[![lyroyce](https://avatars.githubusercontent.com/u/2872392?v=4)](https://github.com/lyroyce "lyroyce (18 commits)")

---

Tags

jsonapirestsoapwsse

### Embed Badge

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

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

###  Alternatives

[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69114.3k](/packages/serpapi-google-search-results-php)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[jsor/hal-client

A lightweight client for consuming and manipulating Hypertext Application Language (HAL) resources.

2425.9k1](/packages/jsor-hal-client)[elao/json-http-form-bundle

Adds support of JSON requests for Forms

356.0k](/packages/elao-json-http-form-bundle)

PHPackages © 2026

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