PHPackages                             rnd-cosoft/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. [Framework](/categories/framework)
4. /
5. rnd-cosoft/api-tools

ActiveLibrary[Framework](/categories/framework)

rnd-cosoft/api-tools
====================

Laminas API Tools module for Laminas

1.8.1(2y ago)01.4k12BSD-3-ClausePHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0

Since Dec 31Pushed 2y agoCompare

[ Source](https://github.com/rnd-cosoft/api-tools)[ Packagist](https://packagist.org/packages/rnd-cosoft/api-tools)[ Docs](https://api-tools.getlaminas.org)[ RSS](/packages/rnd-cosoft-api-tools/feed)WikiDiscussions 1.8.x Synced 1mo ago

READMEChangelog (2)Dependencies (23)Versions (28)Used By (2)

Laminas API Tools
=================

[](#laminas-api-tools)

[![Build Status](https://github.com/laminas-api-tools/api-tools/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas-api-tools/api-tools/actions/workflows/continuous-integration.yml)

> ## 🇷🇺 Русским гражданам
>
> [](#-русским-гражданам)
>
> Мы, участники Laminas, родились и живем в разных странах. У многих из нас есть друзья, родственники и коллеги как в России, так и в Украине. Некоторые из нас родились в России. Некоторые из нас живут в России. У некоторых бабушки и дедушки сражались с фашистами во Второй мировой войне. Здесь никто не поддерживает фашизм.
>
> У одного из нас есть украинская родственница, которая спаслась из дома вместе с сыном. Поезд задержался из-за бомбежки на дороге впереди. У нас есть друзья, которые прячутся в бомбоубежищах. Мы с тревогой ждем весточки от них после воздушных налетов, которые беспорядочно наносят удары и попадают по больницам, школам, детским садам и домам. Мы не берем это из каких-либо СМИ. Мы наблюдаем это напрямую.
>
> Вы доверяете нам достаточно, чтоб использовать наши программы, и мы просим вас довериться нам вновь. Мы нуждаемся в помощи. Выходите и протестуйте против этой бесполезной войны. Остановите кровопролитие. Скажите "Нет войне!"
>
> ## 🇺🇸 To Citizens of Russia
>
> [](#-to-citizens-of-russia)
>
> We at Laminas come from all over the world. Many of us have friends, family and colleagues in both Russia and Ukraine. Some of us were born in Russia. Some of us currently live in Russia. Some have grandparents who fought Nazis in World War II. Nobody here supports fascism.
>
> One team member has a Ukrainian relative who fled her home with her son. The train was delayed due to bombing on the road ahead. We have friends who are hiding in bomb shelters. We anxiously follow up on them after the air raids, which indiscriminately fire at hospitals, schools, kindergartens and houses. We're not taking this from any media. These are our actual experiences.
>
> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"

Introduction
------------

[](#introduction)

Meta-module for Laminas combining features from:

- api-tools-api-problem
- api-tools-content-negotiation
- api-tools-content-validation
- api-tools-hal
- api-tools-mvc-auth
- api-tools-rest
- api-tools-rpc
- api-tools-versioning

in order to provide a cohesive solution for exposing web-based APIs.

Also features database-connected REST resources.

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

[](#requirements)

Please see the [composer.json](composer.json) file.

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

[](#installation)

Run the following `composer` command:

```
$ composer require laminas-api-tools/api-tools
```

Alternately, manually add the following to your `composer.json`, in the `require` section:

```
"require": {
    "laminas-api-tools/api-tools": "^1.3"
}
```

And then run `composer update` to ensure the module is installed.

Finally, add the module name to your project's `config/application.config.php` under the `modules`key:

```
return [
    /* ... */
    'modules' => [
        /* ... */
        'Laminas\ApiTools',
    ],
    /* ... */
];
```

> ### laminas-component-installer
>
> [](#laminas-component-installer)
>
> If you use [laminas-component-installer](https://github.com/laminas/laminas-component-installer), that plugin will install api-tools, and all modules it depends on, as a module in your application configuration for you.

Assets
------

[](#assets)

If you are using this module along with the [admin](https://github.com/laminas-api-tools/api-tools-admin)and/or the [welcome screen](https://github.com/laminas-api-tools/api-tools-welcome), this module contains assets that you will need to make web accessible. For that, you have two options:

- [rwoverdijk/assetmanager](https://github.com/rwoverdijk/AssetManager) is a Laminas module that provides advanced capabilities around web asset management, and is the original tool used by this module. At its current release (1.6.0), however, it does not support v3 components from Laminas. An upcoming 1.7.0 release will likely support them.
- [laminas-api-tools/api-tools-asset-manager](https://github.com/laminas-api-tools/api-tools-asset-manager) is a Composer plugin that acts during installation and uninstallation of packages, copying and removing asset trees as defined using the configuration from rwoverdijk/assetmanager. To use this, however, you will need to install the plugin *first*, and then this module. (If you have already installed this module, remove it using `composer remove laminas-api-tools/api-tools`.)

Configuration
-------------

[](#configuration)

### User Configuration

[](#user-configuration)

The top-level configuration key for user configuration of this module is `api-tools`.

#### db-connected

[](#db-connected)

`db-connected` is an array of resources that can be built via the [TableGatewayAbstractFactory](#apitoolstablegatewayabstractfactory) and the [DbConnectedResourceAbstractFactory](#apitoolsdbconnectedresourceabstractfactory) when required to fulfill the use case of database table-driven resource use cases. The following example enumerates all of the required and optional configuration necessary to enable this.

Example:

```
'db-connected' => [
    /**
     * This is sample configuration for a DB-connected service.
     * Each such service requires an adapter, a hydrator, an entity, and a
     * collection.
     *
     * The TableGateway will be called "YourDBConnectedResource\Table" should
     * you wish to retrieve it manually later.
     */
    'YourDBConnectedResource' => [
        'table_service'    => 'Optional; if present, this service will be used as the table gateway',
        'resource_class'   => 'Optional; if present, this class will be used as the db-connected resource',
        'table_name'       => 'Name of DB table to use',
        'identifier_name'  => 'Optional; identifier field in table; defaults to table_name_id or id',
        'adapter_name'     => 'Service Name for DB adapter to use',
        'hydrator_name'    => 'Service Name for Hydrator to use',
        'entity_class'     => 'Name of entity class to which to hydrate',
        'collection_class' => 'Name of collection class which iterates entities; should be a Paginator extension',
    ],
],
```

### System Configuration

[](#system-configuration)

The following configuration is required to ensure the proper functioning of this module in Laminas Framework applications, and is provided by the module:

```
namespace Laminas\ApiTools;

use Laminas\Db\Adapter\AdapterAbstractServiceFactory as DbAdapterAbstractServiceFactory;
use Laminas\ServiceManager\Factory\InvokableFactory;

return [
    'asset_manager' => [
        'resolver_configs' => [
            'paths' => [
                __DIR__ . '/../asset',
            ],
        ],
    ],
    'router' => [
        'routes' => [
            'api-tools' => [
                'type'  => 'literal',
                'options' => [
                    'route' => '/api-tools',
                ],
                'may_terminate' => false,
            ],
        ],
    ],
    'service_manager' => [
        'factories' => [
            MvcAuth\UnauthenticatedListener::class => InvokableFactory::class,
            MvcAuth\UnauthorizedListener::class => InvokableFactory::class,
        ],
        'abstract_factories' => [
            DbAdapterAbstractServiceFactory::class, // so that db-connected works "out-of-the-box"
            DbConnectedResourceAbstractFactory::class,
            TableGatewayAbstractFactory::class,
        ],
    ],
];
```

Laminas Events
--------------

[](#laminas-events)

### Listeners

[](#listeners)

#### Laminas\\ApiTools\\MvcAuth\\UnauthenticatedListener

[](#laminasapitoolsmvcauthunauthenticatedlistener)

This listener is attached to `MvcAuthEvent::EVENT_AUTHENTICATION_POST` at priority `100`. The primary purpose fo this listener is to override the `api-tools-mvc-auth` *unauthenticated* listener in order to be able to respond with an API-Problem response (vs. a standard HTTP response) on authentication failure.

#### Laminas\\ApiTools\\MvcAuth\\UnauthorizedListener

[](#laminasapitoolsmvcauthunauthorizedlistener)

This listener is attached to `MvcAuthEvent::EVENT_AUTHORIZATION_POST` at priority `100`. The primary purpose of this listener is to override the `api-tools-mvc-auth` *unauthorized* listener in order to be able to respond with an API-Problem response (vs a standard HTTP response) on authorization failure.

#### Laminas\\ApiTools\\Module

[](#laminasapitoolsmodule)

This listener is attached to `MvcEvent::EVENT_RENDER` at priority `400`. Its purpose is to conditionally attach `Laminas\ApiTools\ApiProblem\RenderErrorListener` when an `MvcEvent`'s result is a `HalJsonModel` or `JsonModel`, ensuring `api-tools-api-problem` can render a response in situations where a rendering error occurs.

Laminas Services
----------------

[](#laminas-services)

### Factories

[](#factories)

#### Laminas\\ApiTools\\DbConnectedResourceAbstractFactory

[](#laminasapitoolsdbconnectedresourceabstractfactory)

This factory uses the requested name in addition to the `api-tools.db-connected` configuration in order to produce `Laminas\ApiTools\DbConnectedResource` based resources.

#### Laminas\\ApiTools\\TableGatewayAbstractFactory

[](#laminasapitoolstablegatewayabstractfactory)

This factory uses the requested name in addition to the `api-tools.db-connected` configuration in order to produce correctly configured `Laminas\Db\TableGateway\TableGateway` instances. These instances of `TableGateway`s are configured to use the proper `HydratingResultSet` and produce the configured entities with each row returned when iterated.

### Models

[](#models)

#### Laminas\\ApiTools\\DbConnectedResource

[](#laminasapitoolsdbconnectedresource)

This instance serves as the base class for database connected REST resource classes. This implementation is an extension of `Laminas\ApiTools\Rest\AbstractResourceListener` and can be routed to by Laminas API Tools as a RESTful resource.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 72% 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 ~59 days

Recently: every ~76 days

Total

28

Last Release

738d ago

Major Versions

0.9.1 → 1.0.02019-12-31

PHP version history (9 changes)0.6.0PHP &gt;=5.3.3

0.8.0PHP &gt;=5.4.8

0.9.0PHP &gt;=5.3.23

1.2.0PHP &gt;=5.5

1.3.0PHP ^5.6 || ^7.0

1.5.0PHP ^7.3 || ~8.0.0

1.6.0PHP ^7.3 || ~8.0.0 || ~8.1.0

1.7.0PHP ~8.0.0 || ~8.1.0 || ~8.2.0

1.8.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1388877?v=4)[Kristijonas Lučinskas](/maintainers/kristijonas)[@Kristijonas](https://github.com/Kristijonas)

---

Top Contributors

[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (203 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (33 commits)")[![ralphschindler](https://avatars.githubusercontent.com/u/76674?v=4)](https://github.com/ralphschindler "ralphschindler (20 commits)")[![alexdenvir](https://avatars.githubusercontent.com/u/1412074?v=4)](https://github.com/alexdenvir "alexdenvir (4 commits)")[![geerteltink](https://avatars.githubusercontent.com/u/9497586?v=4)](https://github.com/geerteltink "geerteltink (3 commits)")[![ezimuel](https://avatars.githubusercontent.com/u/475967?v=4)](https://github.com/ezimuel "ezimuel (3 commits)")[![rnd-cosoft](https://avatars.githubusercontent.com/u/57006314?v=4)](https://github.com/rnd-cosoft "rnd-cosoft (3 commits)")[![tafax](https://avatars.githubusercontent.com/u/2297991?v=4)](https://github.com/tafax "tafax (3 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (2 commits)")[![rogervila](https://avatars.githubusercontent.com/u/6053012?v=4)](https://github.com/rogervila "rogervila (2 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (2 commits)")[![EvanDotPro](https://avatars.githubusercontent.com/u/5607?v=4)](https://github.com/EvanDotPro "EvanDotPro (1 commits)")[![kersysgediminas](https://avatars.githubusercontent.com/u/51697762?v=4)](https://github.com/kersysgediminas "kersysgediminas (1 commits)")[![ekosogin](https://avatars.githubusercontent.com/u/13533292?v=4)](https://github.com/ekosogin "ekosogin (1 commits)")[![snapshotpl](https://avatars.githubusercontent.com/u/312655?v=4)](https://github.com/snapshotpl "snapshotpl (1 commits)")

---

Tags

apiframeworklaminasapi-tools

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laminas-api-tools/api-tools

Laminas API Tools module for Laminas

371.7M10](/packages/laminas-api-tools-api-tools)[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[laminas-api-tools/api-tools-admin

Laminas API Tools Admin module

13794.3k5](/packages/laminas-api-tools-api-tools-admin)[laminas-api-tools/api-tools-oauth2

Laminas module for implementing an OAuth2 server

112.0M5](/packages/laminas-api-tools-api-tools-oauth2)[laminas-api-tools/api-tools-skeleton

Skeleton Application for Laminas API Tools

5520.7k](/packages/laminas-api-tools-api-tools-skeleton)

PHPackages © 2026

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