PHPackages                             phore/micro-app - 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. phore/micro-app

ActiveLibrary[Framework](/categories/framework)

phore/micro-app
===============

Micro framework for rest api webservices

v0.3.1(5y ago)05.9k[2 issues](https://github.com/phore/phore-micro-app/issues)4MITPHPPHP &gt;7.1

Since Sep 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/phore/phore-micro-app)[ Packagist](https://packagist.org/packages/phore/micro-app)[ Docs](https://infracamp.org/phore/)[ RSS](/packages/phore-micro-app/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (6)Versions (6)Used By (4)

Minimalistic Microservice Framework
===================================

[](#minimalistic-microservice-framework)

This documentation is written along the guidelines of educational grade documentation discussed in the [infracamp](https://github.com/infracamp/infracamp/blob/master/DOCUMENTATION_GUIDE.md) project. Please ask and document issues.

Goals
-----

[](#goals)

- Minimal Footprint
- No external dependencies
- Clear and small stack trace
- Fluent Api
- Role-Based Authentication

Quicklinks

- Assets
- Authentication
- Session
- OAuth
- Firewall ACL

Naming conventions
------------------

[](#naming-conventions)

Classes for micro-app and libraries are **not** prefixed with `phore_` for convenience. (It's not framework for framework stuff)

Quickstart
----------

[](#quickstart)

`index.php:`

```
$app = new App();

$app->router
    ->onGet("/",                                              // Define a Action for HTTP-GET-Requests to /
        function() {
            return "Hello world";                             // Important: Return true if output was already sent.
        }
    );

$app->serve();                                                // Run the App
```

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

[](#installation)

We suggest using [composer](http://getcomposer.com):

```
composer require phore/micro-app

```

[Routing](docs/router/routing.md) *([Example](docs/router/routing-example.php))*
--------------------------------------------------------------------------------

[](#routing-example)

Define routes (Path) and connect them to controller functions:

- Execute the function if the browser hits `http://domain.xy/hello/world`:

    ```
    $app->router->onGet("/hello/world", function() {
        echo "Hello World";
        return true;
    });
    ```
- Define Parameters (Prefix `:`) and optional parameters (`?`) in Routes:

    ```
    $app->router->onGet("/api/create/:userId/:userName?", function(RouteParams $routeParams) {
        echo "Hello {$routeParams->get("userId")} - {$routeParams->get("userName", 'Default Username')}";
        return true;
    });
    ```

    *`$routeParams`* is automaticly generated by Dependency injection.
- Delegate a request to a separate class: [see Example](doc/router/routing-delegate-example.php)

    ```
    $app->router->delegate("/admin/*", AdminController::class);
    ```
- Add a controller Class:

    ```
    class ActionCtrl {
        const ROUTE = "/v1/some/route"
        public function on_get(){}
    }
    $app->addCtrl(ActionCtrl::class);
    ```

Parameters at controller function are generated by Dependency Injection and may contain any service defined in DiContainer.

Request specific parameters are:

Parameter NameClassNameDescription`$request``Request`The full request object`$post``Post`Post data`$get``Get`Get data (Query Params)`$body``Body`Body object`$files``Files``$route``Route`The current route object`$params``Params`Container with QueryParameters`$routeParams``RouteParams`Container with parameters`$GET``QueryParams`Query parameters`$POST``QueryParams`Parameters send by HTTP-POSTDependency Injection
--------------------

[](#dependency-injection)

The app-class is a dependency injection container. You can register values or services using the `define()` method.

- Define a value to property `version`:

    ```
    $app->define("version", new DiValue("1.0.1"));
    echo $app->version;
    ```
- Define a factory to property `configFile`:

    ```
    $app->define("configFile", new DiService(function() {
        return file_get_contents("config-file.json")
    });
    echo $app->configFile;
    ```

Error Handling
--------------

[](#error-handling)

The system has build-in functions for error-handling:

- Activate `json` error/exception handling: ```
    $app->setOnExceptionHandler(new JsonExceptionHandler());

    ```

API Usage: Default Result Handler
---------------------------------

[](#api-usage-default-result-handler)

Instead of formating the Result your own, the framework uses a result-handler to format results returned by `return` in controller.

```
$app->setDefaultResultHandler(new JsonResultHandler());

```

in the controller you can then just return the data:

```
$app->get("/", function() {
    return ["data"=>"someData"];
}
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% 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 ~302 days

Total

4

Last Release

1901d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/878a384d056698a2400e4b7c8858db05a6caebb2c560e67151be36d46d58def0?d=identicon)[dermatthes](/maintainers/dermatthes)

---

Top Contributors

[![dermatthes](https://avatars.githubusercontent.com/u/13380559?v=4)](https://github.com/dermatthes "dermatthes (90 commits)")[![mikoma](https://avatars.githubusercontent.com/u/2332359?v=4)](https://github.com/mikoma "mikoma (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phore-micro-app/health.svg)

```
[![Health](https://phpackages.com/badges/phore-micro-app/health.svg)](https://phpackages.com/packages/phore-micro-app)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

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