PHPackages                             riverwaysoft/api-tools - 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. riverwaysoft/api-tools

ActiveLibrary

riverwaysoft/api-tools
======================

Api tools

0.2.9.6(2y ago)055.4k↓43.8%1[1 issues](https://github.com/riverwaysoft/api-tools/issues)proprietaryPHPPHP ^8.0|^8.1

Since Aug 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/riverwaysoft/api-tools)[ Packagist](https://packagist.org/packages/riverwaysoft/api-tools)[ RSS](/packages/riverwaysoft-api-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (30)Used By (0)

Api tools
=========

[](#api-tools)

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

[](#installation)

`composer req riverwaysoft/api-tools`

What's inside?
--------------

[](#whats-inside)

### TelephoneObject

[](#telephoneobject)

Wrapper around libphonenumber + PhoneNumberType for DoctrineType. Configuration:

```
doctrine:
    dbal:
        types:
            phone_number: Riverwaysoft\ApiTools\Telephone\Doctrine\DBAL\Types\TelephoneObjectType
```

### ApiPlatform extra

[](#apiplatform-extra)

#### Extra serializers (Enum, TelephoneObject, Money)

[](#extra-serializers-enum-telephoneobject-money)

Configuration:

```
$services
    ->load('Riverwaysoft\\ApiTools\\ApiPlatform\\Serializer\\', __DIR__ . '/../vendor/riverwaysoft/api-tools/src/Lib/ApiPlatform/Serializer');

```

#### Extra filters (look riveradmin ;))

[](#extra-filters-look-riveradmin-)

- RiverAdminEnumSearchFilter
- RiverAdminSearchFilter
- RiverAdminBooleanFilter
- AbstractFullTextSearchFilter

### Domain Events

[](#domain-events)

Usage:

```
class UserRegisteredMessage {
    public function __construct(public string $username) {}
}

use Riverwaysoft\ApiTools\DomainEvents\EventSourceCollector;
class User extends EventSourceCollector {

    public function signUp(string $username){
        $this->rememberMessage(new UserRegisteredMessage($username));
    }

}

# After that message can be consumed with:

$user = new User();
$messages = $user->popMessages();
```

Or it can be done automatically with doctrine adapter:

Configuration:

```
    $services->set(Riverwaysoft\ApiTools\DomainEvents\Doctrine\DoctrineDomainEventsCollector::class)->public()
        ->tag('doctrine.event_listener', ['event' => "postPersist"])
        ->tag('doctrine.event_listener', ['event' => "postUpdate"])
        ->tag('doctrine.event_listener', ['event' => "postFlush"])
        ->tag('doctrine.event_listener', ['event' => "postLoad"]);
```

### InputValueResolver

[](#inputvalueresolver)

A set of automatic serializers of HTTP POST body and GET query into typed objects.

`#[Query]` attribute usage:

```
class UserFilter
{
    public function __construct(
        public int $ageGreaterThan,
        public string $name,
    ) {
    }
}

class CreateUserInput {
    public function __construct(
        public int $age,
        public string $name,
    ) {
    }
}

use Riverwaysoft\ApiTools\InputValueResolver\Query;
use Riverwaysoft\ApiTools\InputValueResolver\Input;

class UserController
{
    #[Route('/api/users', methods: ['GET'])]
    public function getUsers(#[Query] UserFilter $userFilter)
    {
        // Use $userFilter for requests like
        // /api/users?ageGreaterThan=18&name=test
    }

    #[Route('/api/users', methods: ['POST'])]
    public function createUser(#[Input] CreateUserInput $input)
    {
        // variable $input will be automatically created
        // from the request body
    }
}
```

Configuration in services.yml:

```
  Riverwaysoft\ApiTools\InputValueResolver\:
    resource: '../vendor/riverwaysoft/api-tools/src/InputValueResolver'

```

### UnicodeIgnoreOrderJsonDriver

[](#unicodeignoreorderjsondriver)

A driver for the [phpunit-snapshot-assertions](https://github.com/spatie/phpunit-snapshot-assertions) library. This driver is responsible for 3 main things:

1. Show unicode characters unescaped in json, so you'll see "£" instead of "\\u00a3"
2. Ignore property order. Example equal json `{a: 1, b: 2}` and `{b: 2, a: 1}`
3. Ignore order of array elements in json. Example equal json arrays `[{a: 1}, {b: 2}]` and `[{b: 2}, {a: 1}]`

#### How to use

[](#how-to-use)

Add the following trait to all your tests:

```
use Riverwaysoft\ApiTools\Testing\UnicodeIgnoreOrderJsonDriver;

//

public function assertMatchesJsonUnicodeSnapshot(mixed $actual): void
{
    $this->assertMatchesSnapshot($actual, new UnicodeIgnoreOrderJsonDriver());
}
```

Use `assertMatchesJsonUnicodeSnapshot` instead of the `assertMatchesJsonSnapshot`.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 52.2% 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

Every ~30 days

Recently: every ~21 days

Total

25

Last Release

1000d ago

PHP version history (2 changes)v0.1.1PHP ^8.0

0.2.9PHP ^8.0|^8.1

### Community

Maintainers

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

---

Top Contributors

[![kubk](https://avatars.githubusercontent.com/u/22447849?v=4)](https://github.com/kubk "kubk (24 commits)")[![mitalcoi](https://avatars.githubusercontent.com/u/3224226?v=4)](https://github.com/mitalcoi "mitalcoi (22 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/riverwaysoft-api-tools/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[symfony/serializer-pack

A pack for the Symfony serializer

1.1k28.2M221](/packages/symfony-serializer-pack)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1195.3M72](/packages/web-auth-webauthn-lib)

PHPackages © 2026

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