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

ActiveLibrary[Framework](/categories/framework)

cindyullmann/statuslib-example
==============================

Library for use with Laminas API Tools documentation examples

1.0.0(1y ago)021BSD-3-ClausePHPPHP ^7.3 || ~8.0.0 || ^8.1

Since May 29Pushed 1y agoCompare

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

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

StatusLib
=========

[](#statuslib)

[![Build Status](https://github.com/laminas-api-tools/statuslib-example/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/laminas-api-tools/statuslib-example/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!"

This is a library designed to demonstrate an [Laminas API Tools](https://api-tools.getlaminas.org/) "Code-Connected" REST API, and has been written in parallel with the [Laminas API Tools documentation](https://github.com/laminas-api-tools/api-tools-documentation).

It uses the following components:

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

It is written as a Laminas 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 laminas-api-tools/statuslib-example
```

If you are using this as part of a Laminas or Laminas API Tools application, you may need to enable the module in your `config/application.config.php` file, if you are not using the [laminas-component-installer](https://docs.laminas.dev/laminas-component-installer/):

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

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

[](#configuration)

When used as a Laminas 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 Laminas API Tools examples, we suggest the following:

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

    ```
