PHPackages                             andrewscaya/statuslib-example - 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. andrewscaya/statuslib-example

ActiveLibrary[Framework](/categories/framework)

andrewscaya/statuslib-example
=============================

Library for use with Apigility documentation examples

1.2.0(8y ago)018BSD-3-ClausePHPPHP ^5.6 || ^7.0

Since Apr 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/andrewscaya/statuslib-example)[ Packagist](https://packagist.org/packages/andrewscaya/statuslib-example)[ Docs](http://apigility.org/)[ RSS](/packages/andrewscaya-statuslib-example/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (7)Versions (6)Used By (0)

StatusLib
=========

[](#statuslib)

This is a library designed to demonstrate an [Apigility](http://apigility.org/) "Code-Connected" REST API, and has been written in parallel with the [Apigility documentation](https://github.com/zfcampus/apigility-documentation).

It uses the following components:

- [rhumsaa/uuid](https://github.com/ramsey/uuid), a library for generating and validating UUIDs.
- [zfcampus/zf-configuration](https://github.com/zfcampus/zf-configuration), used for providing PHP files as one possible backend for reading/writing status messages.
- [zendframework/zend-config](https://framework.zend.com/) for the actual configuration writer used by the `zf-configuration` module.
- [zendframework/zend-db](https://framework.zend.com/), used for providing a database table as a backend for reading/writing status messages.
- [zendframework/zend-stdlib](https://framework.zend.com/), specifically the Hydrator subcomponent, for casting data from arrays to objects, and for the `ArrayUtils` class, which provides advanced array merging capabilities.
- [zendframework/zend-paginator](https://framework.zend.com/) for providing pagination.

It is written as a Zend Framework module, but could potentially be dropped into other applications; use the `StatusLib\*Factory` classes to see how dependencies might be injected.

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install the library in your application:

```
$ composer require zfcampus/statuslib-example
```

If you are using this as part of a Zend Framework or Apigility application, you may need to enable the module in your `config/application.config.php` file, if you are not using the [zend-component-installer](https://docs.zendframework.com/zend-component-installer/):

```
return [
    /* ... */
    'modules' => [
        /* ... */
        'StatusLib',
    ],
    /* ... */
];
```

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

[](#configuration)

When used as a Zend Framework module, you may define the following configuration values in order to tell the library which adapter to use, and what options to pass to that adapter.

```
[
    'statuslib' => [
        'db' => 'Name of service providing DB adapter',
        'table' => 'Name of database table within db to use',
        'array_mapper_path' => 'path to PHP file returning an array for use with ArrayMapper',
    ],
    'service_manager' => [
        'aliases' => [
            // Set to either StatusLib\ArrayMapper or StatusLib\TableGatewayMapper
            \StatusLib\Mapper::class => \StatusLib\ArrayMapper::class,
        ],
    ],
]
```

For purposes of the Apigility examples, we suggest the following:

- Create a PHP file in your application's `data/` directory named `statuslib.php` that returns an array:

    ```
