PHPackages                             geggleto/slimgateway - 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. [API Development](/categories/api)
4. /
5. geggleto/slimgateway

ActiveLibrary[API Development](/categories/api)

geggleto/slimgateway
====================

0.0.1(10y ago)117MITPHP

Since Apr 21Pushed 10y ago2 watchersCompare

[ Source](https://github.com/geggleto/slimgateway)[ Packagist](https://packagist.org/packages/geggleto/slimgateway)[ RSS](/packages/geggleto-slimgateway/feed)WikiDiscussions master Synced 4w ago

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

Slim Gateway
============

[](#slim-gateway)

Take the boilerplate out of your day. Need a simple API to insert data into SQL Tables? This is for you.

Setup
=====

[](#setup)

- Change the contents of `config/db.env.php` to connect to your database
- To define your resources:
    - Create Validators in `config/validators.php`
    - Create a Gateway and Controller entry in `config/db.php`
    - Define your routes in `config/routes.php`
    - Run the users migration `composer migrate:users`

Install
=======

[](#install)

```
`php composer.phar create-project geggleto/slimgateway [my-app-name]`

```

Validation
==========

[](#validation)

There is a cavet for validation. Validation will only take place on the initial data set, anything you add in via middleware is not available for validation.

Migrations
==========

[](#migrations)

- Add more migrations in the `/migrations/` folder
- Add a composer command to make running them easy!
- Make sure to add the composer command to the unit tests when you do then too!

Example
=======

[](#example)

### In `config/db.php`

[](#in-configdbphp)

```
$container['users.gateway'] = function ($c) {
    return new TableGateway('user', $c['adapter']);
};

$container['user.controller'] = function ($c) {
    return new EntityController($c['users.gateway']);
};
```

### In `config/validators.php`

[](#in-configvalidatorsphp)

```
$container['user.fetch.validator'] = function ($c) {
    /** @var $request \Slim\Http\Request */
    $request = $c['request'];
    $validator = new \Valitron\Validator($request->getParsedBody());
    $validator->rule('required', 'id');

    new \SlimGateway\ValidationMiddleware($validator);
};

$container['user.create.validator'] = function ($c) {
    /** @var $request \Slim\Http\Request */
    $request = $c['request'];
    $validator = new \Valitron\Validator($request->getParsedBody());
    $validator->rule('required', 'name');
    $validator->rule('required', 'email');
    $validator->rule('required', 'username');
    $validator->rule('required', 'password');

    new \SlimGateway\ValidationMiddleware($validator);
};

$container['user.update.validator'] = function ($c) {
    /** @var $request \Slim\Http\Request */
    $request = $c['request'];
    $validator = new \Valitron\Validator($request->getParsedBody());
    $validator->rule('required', 'name');
    $validator->rule('required', 'email');
    $validator->rule('required', 'username');

    new \SlimGateway\ValidationMiddleware($validator);
};

$container['user.delete.validator'] = function ($c) {
    /** @var $request \Slim\Http\Request */
    $request = $c['request'];
    $validator = new \Valitron\Validator($request->getParsedBody());
    $validator->rule('required', 'id');

    new \SlimGateway\ValidationMiddleware($validator);
};
```

### In `config/routes.php`

[](#in-configroutesphp)

```
$app->get('/users/{id}', 'user.controller:fetch')->add('user.fetch.validator');
$app->post('/users', 'user.controller:create')->add('user.create.validator');
$app->put('/users/{id}', 'user.controller:update')->add('user.update.validator');
$app->delete('/users/{id}', 'user.controller:remove')->add('user.delete.validator');
```

Unit Testing
============

[](#unit-testing)

`composer test`

Where to go from here
=====================

[](#where-to-go-from-here)

This is purely a backend solution. The next logical step might be trying to send out an email, or encrypt the user password. Both of these functions would be middleware when using this package.

Middleware is the perfect spot for running code before and after your data is persisted.

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.7% 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

Unknown

Total

1

Last Release

3722d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f941aecd52e3f8ac94dbe9b714801c7adc767acc32644d3ee6a4efeded84c5e?d=identicon)[geggleto](/maintainers/geggleto)

---

Top Contributors

[![geggleto](https://avatars.githubusercontent.com/u/4027602?v=4)](https://github.com/geggleto "geggleto (13 commits)")[![matthewtrask](https://avatars.githubusercontent.com/u/4731244?v=4)](https://github.com/matthewtrask "matthewtrask (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geggleto-slimgateway/health.svg)

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

###  Alternatives

[showdoc/showdoc

ShowDoc is a tool greatly applicable for an IT team to share documents online

12.8k7.1k](/packages/showdoc-showdoc)[brandembassy/slim-nette-extension

19198.2k](/packages/brandembassy-slim-nette-extension)[oat-sa/tao-core

TAO core extension

66140.1k108](/packages/oat-sa-tao-core)[b13/slimphp-bridge

Provides a middleware for registering Slim PHP applications within TYPO3 Frontend Sites

2048.8k1](/packages/b13-slimphp-bridge)[duxweb/dux-lite

The lightweight framework based on slim php

161.0k9](/packages/duxweb-dux-lite)

PHPackages © 2026

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