PHPackages                             smalldb/smalldb-rest - 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. smalldb/smalldb-rest

ActiveLibrary

smalldb/smalldb-rest
====================

Simple REST API for Smalldb

v0.5(9y ago)2281Apache-2.0PHP

Since Mar 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/smalldb/smalldb-rest)[ Packagist](https://packagist.org/packages/smalldb/smalldb-rest)[ Docs](https://smalldb.org/)[ RSS](/packages/smalldb-smalldb-rest/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Smalldb-REST
============

[](#smalldb-rest)

Simple implementation of REST API for Smalldb.

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

[](#requirements)

- PHP 5.5+
- libsmalldb

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

[](#installation)

1. Use `composer install` to install all libraries.
2. Create `api-v1.php` and `api-v1-diagram.php` as in examples.
3. Create state machine definitions in `statemachine` directory -- see libsmalldb documentation for details.
4. Before use in production environment change the `auth.class` option to something less permissive. -- The `config.json.php` contains option to allow everything. The default is to use `CookieAuth` class, but that requires some configuration.

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

[](#configuration)

Configuration is loaded from three JSON files. Later overwrites the previous (using `array_replace_recursive` function).

- `config.json.php` in Smalldb-REST's directory to load default values.
- `config.app.json.php` in the project's root directory to load application-specific options. This file should be under version control, do not put sensitive informations here.
- `config.local.json.php` in the project's root directory to load installation-specific options. This file should NOT be under version control (put it into `.gitignore`), it is meant to contain sensitive informations.

To achieve forward compatibility of your configuration files do not use whole copy of default config file in your application. Set only changed options instead.

API Usage
---------

[](#api-usage)

Read state of a state machine (machine ID = `"blogpost", 1`):

```
HTTP GET /api-v1.php/blogpost/1

```

Read transition info of a state machine (transition `edit`):

```
HTTP GET /api-v1.php/blogpost/1!edit

```

Invoke transition of a state machine (transition `edit`, parameters are passed via `$_POST['args']`):

```
HTTP POST /api-v1.php/blogpost/1!edit
Content-Type: application/x-www-form-urlencoded

args[0][title]=Some%20title&args[1][text]=Lorem%20ipsum

```

List state machines of given type:

```
HTTP GET /api-v1.php/?type=blogpost

```

State diagram renderer
----------------------

[](#state-diagram-renderer)

The second function of the REST API is state diagram renderer. To retrieve state diagram of the `blogpost` state machine use following HTTP request:

```
HTTP GET /api-v1-diagram.php?machine=blogpost&format=png

```

This mean you can simply put this HTML to your application:

```

```

Note: Diagrams are rendered using Graphviz and cached using APC. The `dot`executable must be somewhere in PHP's PATH.

LICENSE
-------

[](#license)

Apache 2.0 - see LICENSE file

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~24 days

Recently: every ~30 days

Total

6

Last Release

3577d ago

### Community

Maintainers

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

---

Top Contributors

[![jkufner](https://avatars.githubusercontent.com/u/16572?v=4)](https://github.com/jkufner "jkufner (37 commits)")

---

Tags

phprestrest-apismalldbstate-machine

### Embed Badge

![Health badge](/badges/smalldb-smalldb-rest/health.svg)

```
[![Health](https://phpackages.com/badges/smalldb-smalldb-rest/health.svg)](https://phpackages.com/packages/smalldb-smalldb-rest)
```

PHPackages © 2026

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