PHPackages                             comoco/slim-api-bean - 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. comoco/slim-api-bean

ActiveLibrary

comoco/slim-api-bean
====================

A simple and easy to use slim wrapper

0.1.0(7y ago)046MITPHP

Since Apr 23Pushed 7y agoCompare

[ Source](https://github.com/como65416/slim-api-bean)[ Packagist](https://packagist.org/packages/comoco/slim-api-bean)[ RSS](/packages/comoco-slim-api-bean/feed)WikiDiscussions master Synced 3d ago

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

Slim Api Bean
=============

[](#slim-api-bean)

一個將 Slim 封裝起來的 library，簡化一些流程上的操作。

### Document

[](#document)

參考：[文件](DOC.md)

### Api Bean Example

[](#api-bean-example)

建立一個 index.php

```
use comoco\SlimApiBean\Bean as SlimApiBean;
use comoco\SlimApiBean\Handler\AbstractAction;

class HomeAction extends AbstractAction
{
    public function handle($request, $response, $args)
    {
        return "Welcome";
    }
}

class HelloAction extends AbstractAction
{
    public function handle($request, $response, $args)
    {
        $datas = $request->getParsedBody();
        $name = $datas['name'];
        return "hello, {$name}!";
    }
}

$apiBean = new SlimApiBean;
$apiBean->bindAction(['GET', 'POST'], '/', new HomeAction)
    ->bindAction(['POST'], '/hello', new HelloAction)
    ->run();
```

#### 啟動

[](#啟動)

```
php -S localhost:8089
```

#### 發出 request

[](#發出-request)

GET

```
curl -X GET localhost:8089
```

輸出：

```
Welcome

```

POST

```
curl -d "name=Bob" -X POST localhost:8089/hello
```

輸出：

```
hello, Bob!

```

### Test Example

[](#test-example)

```
use comoco\SlimApiBean\Bean as SlimApiBean;
use comoco\SlimApiBean\Handler\AbstractAction;

class HelloAction extends AbstractAction
{
    public function handle($request, $response, $args)
    {
        $datas = $request->getParsedBody();
        $name = $datas['name'];
        return "hello, {$name}!";
    }
}

$apiBean = new SlimApiBean;
$apiBean->bindAction(['POST'], '/hello', new HelloAction);

$response = $apiBean->dryRun('POST', '/hello', [
    'headers' => [
        'Content-Type' => 'application/json'
    ],
    'body' => [
        'name' => 'Bob'
    ]
]);

$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('hello, Bob!', (string) $response->getBody());
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

2570d ago

### Community

Maintainers

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

---

Top Contributors

[![como65416](https://avatars.githubusercontent.com/u/37505722?v=4)](https://github.com/como65416 "como65416 (27 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/comoco-slim-api-bean/health.svg)

```
[![Health](https://phpackages.com/badges/comoco-slim-api-bean/health.svg)](https://phpackages.com/packages/comoco-slim-api-bean)
```

###  Alternatives

[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[oat-sa/tao-core

TAO core extension

66136.7k74](/packages/oat-sa-tao-core)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)[brandembassy/slim-nette-extension

19190.2k](/packages/brandembassy-slim-nette-extension)[docler-labs/codeception-slim-module

Codeception Module for Slim framework.

13178.0k1](/packages/docler-labs-codeception-slim-module)[egroupware/openid

EGroupware OpenID Connect / OAuth2 server

1226.8k2](/packages/egroupware-openid)

PHPackages © 2026

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