PHPackages                             zfcampus/zf-apigility - 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. zfcampus/zf-apigility

Abandoned → [laminas-api-tools/api-tools](/?search=laminas-api-tools%2Fapi-tools)ArchivedLibrary[Framework](/categories/framework)

zfcampus/zf-apigility
=====================

Apigility module for Zend Framework

1.4.0(8y ago)2561.9M↓42.2%50[75 issues](https://github.com/zfcampus/zf-apigility/issues)20BSD-3-ClausePHPPHP ^5.6 || ^7.0

Since Oct 3Pushed 6y ago2 watchersCompare

[ Source](https://github.com/zfcampus/zf-apigility)[ Packagist](https://packagist.org/packages/zfcampus/zf-apigility)[ RSS](/packages/zfcampus-zf-apigility/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (20)Versions (20)Used By (20)

ZF Apigility
============

[](#zf-apigility)

> ## Repository abandoned 2019-12-31
>
> [](#repository-abandoned-2019-12-31)
>
> This repository has moved to [laminas-api-tools/api-tools](https://github.com/laminas-api-tools/api-tools).

[![Build Status](https://camo.githubusercontent.com/720b3adb8a2ce728cf12392da729586c13784164fe94c94724943b86077c7723/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f7a6663616d7075732f7a662d61706967696c6974792e7376673f6272616e63683d6d6173746572)](https://secure.travis-ci.org/zfcampus/zf-apigility)[![Coverage Status](https://camo.githubusercontent.com/b6b3350e5538f281f5d12d2f06b73f2cccef5b0e2533d93e1c8d4b53c928c2cb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7a6663616d7075732f7a662d61706967696c6974792f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/zfcampus/zf-apigility?branch=master)

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

[](#introduction)

Meta-module for Zend Framework combining features from:

- zf-api-problem
- zf-content-negotiation
- zf-content-validation
- zf-hal
- zf-mvc-auth
- zf-rest
- zf-rpc
- zf-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 zfcampus/zf-apigility
```

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

```
"require": {
    "zfcampus/zf-apigility": "^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' => [
        /* ... */
        'ZF\Apigility',
    ],
    /* ... */
];
```

> ### zf-component-installer
>
> [](#zf-component-installer)
>
> If you use [zf-component-installer](https://github.com/zendframework/zf-component-installer), that plugin will install zf-apigility, 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/zfcampus/zf-apigility-admin)and/or the [welcome screen](https://github.com/zfcampus/zf-apigility-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 ZF 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 Zend Framework. An upcoming 1.7.0 release will likely support them.
- [zfcampus/zf-asset-manager](https://github.com/zfcampus/zf-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 zfcampus/zf-apigility`.)

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

[](#configuration)

### User Configuration

[](#user-configuration)

The top-level configuration key for user configuration of this module is `zf-apigility`.

#### db-connected

[](#db-connected)

`db-connected` is an array of resources that can be built via the [TableGatewayAbstractFactory](#zfapigilitytablegatewayabstractfactory) and the [DbConnectedResourceAbstractFactory](#zfapigilitydbconnectedresourceabstractfactory) 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 Zend Framework applications, and is provided by the module:

```
namespace ZF\Apigility;

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

return [
    'asset_manager' => [
        'resolver_configs' => [
            'paths' => [
                __DIR__ . '/../asset',
            ],
        ],
    ],
    'router' => [
        'routes' => [
            'zf-apigility' => [
                'type'  => 'literal',
                'options' => [
                    'route' => '/apigility',
                ],
                '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,
        ],
    ],
];
```

ZF Events
---------

[](#zf-events)

### Listeners

[](#listeners)

#### ZF\\Apigility\\MvcAuth\\UnauthenticatedListener

[](#zfapigilitymvcauthunauthenticatedlistener)

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

#### ZF\\Apigility\\MvcAuth\\UnauthorizedListener

[](#zfapigilitymvcauthunauthorizedlistener)

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

#### ZF\\Apigility\\Module

[](#zfapigilitymodule)

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

ZF Services
-----------

[](#zf-services)

### Factories

[](#factories)

#### ZF\\Apigility\\DbConnectedResourceAbstractFactory

[](#zfapigilitydbconnectedresourceabstractfactory)

This factory uses the requested name in addition to the `zf-apigility.db-connected` configuration in order to produce `ZF\Apigility\DbConnectedResource` based resources.

#### ZF\\Apigility\\TableGatewayAbstractFactory

[](#zfapigilitytablegatewayabstractfactory)

This factory uses the requested name in addition to the `zf-apigility.db-connected` configuration in order to produce correctly configured `Zend\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)

#### ZF\\Apigility\\DbConnectedResource

[](#zfapigilitydbconnectedresource)

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

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity57

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 79.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 ~104 days

Recently: every ~256 days

Total

17

Last Release

2984d ago

Major Versions

0.9.1 → 1.0.0beta12014-03-18

PHP version history (5 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

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/296074?v=4)[Zend Framework](/maintainers/zendframework)[@zendframework](https://github.com/zendframework)

---

Top Contributors

[![weierophinney](https://avatars.githubusercontent.com/u/25943?v=4)](https://github.com/weierophinney "weierophinney (183 commits)")[![ralphschindler](https://avatars.githubusercontent.com/u/76674?v=4)](https://github.com/ralphschindler "ralphschindler (20 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (19 commits)")[![tafax](https://avatars.githubusercontent.com/u/2297991?v=4)](https://github.com/tafax "tafax (3 commits)")[![ezimuel](https://avatars.githubusercontent.com/u/475967?v=4)](https://github.com/ezimuel "ezimuel (3 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (2 commits)")[![EvanDotPro](https://avatars.githubusercontent.com/u/5607?v=4)](https://github.com/EvanDotPro "EvanDotPro (1 commits)")

---

Tags

apiframeworkZendFrameworkzfapigility

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zfcampus-zf-apigility/health.svg)

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

PHPackages © 2026

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