PHPackages                             busarm/armie - 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. busarm/armie

ActiveLibrary[Framework](/categories/framework)

busarm/armie
============

An elegant PHP framework designed to provide high performance with optimal developer experience

v2.0.9(2y ago)481MITPHPPHP ^8.1

Since Aug 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/busarm/armie)[ Packagist](https://packagist.org/packages/busarm/armie)[ RSS](/packages/busarm-armie/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (16)Versions (13)Used By (0)

[![Armie_Logo_256px](https://private-user-images.githubusercontent.com/25706510/261258207-ca6aed95-7931-45de-afca-4d8f9b1498a7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODMwNTQyMjEsIm5iZiI6MTc4MzA1MzkyMSwicGF0aCI6Ii8yNTcwNjUxMC8yNjEyNTgyMDctY2E2YWVkOTUtNzkzMS00NWRlLWFmY2EtNGQ4ZjliMTQ5OGE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzAzVDA0NDUyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5MTFmMTFmMmYwNWIzY2Q5NmY4MmVlNmFjZjU2NTM1MzZkYjRmOTg4NWI4YTg1ODU4YWVlODIwMjZhMzI1ZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.UOVZZUFcSlWeN4InvxrNWhUc6YJ78NVpqAJVJV9qaoY)](https://private-user-images.githubusercontent.com/25706510/261258207-ca6aed95-7931-45de-afca-4d8f9b1498a7.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODMwNTQyMjEsIm5iZiI6MTc4MzA1MzkyMSwicGF0aCI6Ii8yNTcwNjUxMC8yNjEyNTgyMDctY2E2YWVkOTUtNzkzMS00NWRlLWFmY2EtNGQ4ZjliMTQ5OGE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzAzVDA0NDUyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg5MTFmMTFmMmYwNWIzY2Q5NmY4MmVlNmFjZjU2NTM1MzZkYjRmOTg4NWI4YTg1ODU4YWVlODIwMjZhMzI1ZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.UOVZZUFcSlWeN4InvxrNWhUc6YJ78NVpqAJVJV9qaoY)

[![Test](https://github.com/busarm/armie/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/busarm/armie/actions/workflows/php.yml)[![Test](https://camo.githubusercontent.com/46e804ba83aa43d9d3dbd89a548567b1b1c75dd3da32210d58b575d06ed3d6bc/68747470733a2f2f706f7365722e707567782e6f72672f62757361726d2f61726d69652f6c6963656e7365)](https://packagist.org/packages/busarm/armie)[![Latest Stable Version](https://camo.githubusercontent.com/fdb389c1bab6b0165100891171a5b83a992482e79784c4a9f99b323d8a95a864/68747470733a2f2f706f7365722e707567782e6f72672f62757361726d2f61726d69652f76)](https://packagist.org/packages/busarm/armie)[![PHP Version Require](https://camo.githubusercontent.com/4fbf113872c6603fe1f7f4b97a4cc2c4892f2c43f1a351998ac9fd28663a7dc2/68747470733a2f2f706f7365722e707567782e6f72672f62757361726d2f61726d69652f726571756972652f706870)](https://packagist.org/packages/busarm/armie)

Table of Contents
-----------------

[](#table-of-contents)

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
    - [Traditional HTTP Server](#traditional-http-server)
        - [Single Application](#single-application)
        - [Multi Tenant Application](#multi-tenant-application)
    - [Asynchronous HTTP Server](#asynchronous-http-server-powered-by-workerman)
- [Configs](#configs)
    - [Using Config Files](#using-config-files)
        - [Create Config File](#create-config-file)
        - [Add Config File](#add-config-file)
- [Route](#route)
    - [Controller Route](#controller-route)
    - [Anonymous Route](#anonymous-route)
    - [View Route](#view-route)
    - [Custom Route Class](#custom-route-class)
- [Providers](#providers)
    - [Create Provider](#create-provider)
    - [Attach Provider](#attach-provider)
- [Middleware](#middleware)
    - [Create Middleware](#create-middleware)
    - [Attach Middleware](#attach-middleware)
- [Bindings](#bindings)
    - [Add Binding](#add-binding)
    - [Resolve Binding](#resolve-binding)
- [Views](#views)
    - [Generic Component](#generic-component)
    - [Dedicated View Model](#dedicated-view-model)
- [Database](#database-armie-orm)
    - [Define Model](#define-model)
        - [Save Model](#save-model)
        - [Find Item](#find-item)
        - [Get List](#get-list)
    - [Define Repository](#define-repository)
        - [Get Paginated List](#get-paginated-list)
- [Tests](#tests)
- [License](#license)

Introduction
------------

[](#introduction)

Armie is an expressive and extendable lightweight PHP framework designed to provide high performance with all the essential features needed for quick application development.

It is more suited for small applications or microservices but can easily handle the development of large-scale applications with minimum extension or abstraction.

It includes support for different design paradigms and architectural patterns:

- Model-View-Controller (MVC)
- Service-oriented
- Microservices
- Event Driven
- Asynchronous Queuing

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

[](#installation)

`composer require busarm/armie`

Usage
-----

[](#usage)

### Traditional HTTP Server

[](#traditional-http-server)

Traditional HTTP server using PHP-FPM and NGINX or Apache.

#### Single Application

[](#single-application)

Run a single application

```
    # ../myapp/public/index.php

    define('APP_START_TIME', floor(microtime(true) * 1000));
    require __DIR__ . '/../vendor/autoload.php';

    $config = (new Config())
            ->setAppPath(dirname(__DIR__))
            ->setConfigPath('Configs')
            ->setViewPath('Views');
    $app = new App($config);

    $app->get('/product/{id}')->to(ProductController::class, 'get');

    $app->run()->send();
```

#### Multi Tenant Application

[](#multi-tenant-application)

Host multiple applications or modules. Supports path and domain routing

```
    # ../index.php
    require __DIR__ . '/../vendor/autoload.php';

    $server = (new Server())
        // Use `myapp` for requests with path `v1/....`
        ->addRoutePath('v1', __DIR__ . '/myapp/public')
        // Use `mydevapp` for requests with domain name `dev.myapp.com`
        ->addDomainPath('dev.myapp.com', __DIR__ . '/mydevapp/public');
    $server->run()->send();

    # ../myapp/public/index.php

    /**
     * @var \Psr\Http\Message\ServerRequestInterface|null $request Capture Server request
     * @var \Armie\Interfaces\ServiceDiscoveryInterface|null $discovery Capture Service discovery
     */

    require __DIR__ . '/../vendor/autoload.php';

    $config = (new Config())
        ->setAppPath(dirname(__DIR__))
        ->setConfigPath('Configs')
        ->setViewPath('Views');
    $app = new App($config);
    $app->setServiceDiscovery($discovery ?? new LocalServiceDiscovery([]));

    $app->get('/product/{id}')->to(ProductController::class, 'get');

    return $app->run(Request::capture($request ?? null, $config));
```

### Asynchronous HTTP Server *(powered by [workerman](https://github.com/walkor/workerman))*

[](#asynchronous-http-server-powered-by-workerman)

High perfomant Asychronous HTTP Server with support for serveral event-looping providers such as: `swoole`, `libevent`, `ev`, `libuv`, `react`. Provides the following features:

- Background workers to handle multi processing, asynchronous task and cron job processing
- Socket workers to handle web socket connections
- Concurrency with Promises and built in (`async`, `await`, `concurrent`) functions
- Real-time events with built in (`listen`, `dispatch`) functions
- Asynchronous queuing with built in (`enqueue`) function

```
    # ./start.php

    $config = (new Config())
            ->setAppPath(dirname(__DIR__))
            ->setConfigPath('Configs')
            ->setViewPath('Views');
    $app = new App($config);

    $app->get('/product/{id}')->to(ProductController::class, 'get');

    $app->start("localhost", 8080,
        (new HttpServerConfig)
            ->setLooper(Looper::EV)
            ->setHttpWorkers(8)
            ->setTaskWorkers(4)
            ->addJob(function () {
                log_debug("Testing EVERY_MINUTE Cron Job");
            }, Cron::EVERY_MINUTE)
            ->addJob(function () {
                log_debug("Testing Custom Seconds Cron Job");
            }, 600)
            ->addJob(function () {
                log_debug("Testing One-Time Only Job");
            }, (new DateTime('+30 seconds')))
            // MessengerSocketController implements SocketControllerInterface
            ->addSocket(2222, MessengerSocketController::class));
```

Run command to start application

```
# Windows
php start.php

# Unix (Linux or Mac) [Recommended]
php start.php start
```

Configs
-------

[](#configs)

Configure application

```
    $config = (new Config())
        ->setAppPath(__DIR__)
        ->setConfigPath('Configs')
        ->setViewPath('Views')
        ->setSecret("mysamplesecret123456")
        ->setCookieEncrypt(true)
        ->setHttp((new HttpConfig)
            ->setCheckCors(true)
            ->setAllowAnyCorsDomain(true)
            ->setAllowedCorsHeaders(['*'])
            ->setAllowedCorsMethods(['GET']))
        ->setLogRequest(false)
        ->setSessionEnabled(true)
        ->setSessionLifetime(60)
        ->setDb((new PDOConfig)
                ->setConnectionDriver("mysql")
                ->setConnectionHost("127.0.0.1")
                ->setConnectionDatabase('default')
                ->setConnectionPort(3310)
                ->setConnectionUsername("root")
                ->setConnectionPassword("root")
                ->setConnectionPersist(true)
                ->setConnectionErrorMode(true)
                ->setConnectionPoolSize(10)
        );
    $app = new App($config);
    ...
```

### Using Config Files

[](#using-config-files)

Configs can be attached using separate configuration files.

#### Create Config File

[](#create-config-file)

Add config file to your config path. E.g `myapp/Configs/database.php`

```
    # database.php

    // Use constant
    define("DB_NAME", "my-db-dev");
    define("DB_HOST", "localhost");

    // Use dynamic configs
    return [
        'db_name'=>'my-db-dev',
        'db_host'=>'localhost',
    ];
    // Access dynamic configs
    // Set
    app()->config->set('db_name', 'my-db-dev-2');
    // Get
    app()->config->get('db_name');
```

#### Add Config File

[](#add-config-file)

```
    ....
    $config->addFile('database')
    $app = new App($config);
    ....
```

Route
-----

[](#route)

Add HTTP routes.

### Controller Route

[](#controller-route)

```
    ....
    $app = new App($config);
    $app->get('/user/{id}')->to(UserController::class, 'get');
    $app->get('/user/{id}')->to(UserController::class, 'get');
    $app->post('/user/{id}')->to(UserController::class, 'create');
    $app->put('/user/{id}')->to(UserController::class, 'update'),
    $app->delete('/user/{id}')->to(UserController::class, 'delete'),
    $app->run()->send();
```

### Anonymous Route

[](#anonymous-route)

```
    ....
    $app = new App($config);
    $app->get('/user/{id}')->call(function (RequestInterface $request, string $id) {
        // Perform action ...
    });
    $app->run()->send();
```

### View Route

[](#view-route)

```
    ....
    $app = new App($config);
    $app->get('/user/{id}')->view(UserPage::class);
    $app->run()->send();
```

### Custom Route Class

[](#custom-route-class)

```
    ....
    $app = new App($config);
    // Using Custom Route Class - Single
    $app->router->addRoute(MyRoute::get('/user/{id}')->to(UserController::class, 'get'));
    // Using Custom Route Class - List
    $app->router->addRoutes([
        MyRoute::get('/user/{id}')->to(UserController::class, 'get'),
        MyRoute::post('/user')->to(UserController::class, 'create'),
        MyRoute::put('/user/{id}')->to(UserController::class, 'update'),
        MyRoute::delete('/user/{id}')->to(UserController::class, 'delete'),
    ]);
    $app->run()->send();
```

Providers
---------

[](#providers)

Extend application features and configurations.

### Create Provider

[](#create-provider)

```
class CustomProvider implements ProviderInterface
{

    /**
     * @inheritDoc
     */
    public function process(App $app): void
    {
        // Perform custom action....
    }
}
```

### Attach Provider

[](#attach-provider)

```
    ...
    $app = new App($config);
    $app->addProvider(new CustomProvider());
    ...
```

Middleware
----------

[](#middleware)

Intercept HTTP request and response. PSR Middleware supported.

### Create Middleware

[](#create-middleware)

```
    class AuthenticateMiddleware implements MiddlewareInterface
    {
        public function process(RequestInterface|RouteInterface $request, RequestHandlerInterface $handler): ResponseInterface {
            // Perform custom action....
            // Or forward to next request handler
            return $handler->handle($request);
        }
    }
```

### Attach Middleware

[](#attach-middleware)

```
    # Attach global middleware
    ....
    $app = new App($config);
    $app->addMiddleware(new AuthenticateMiddleware())
    ....

    # Attach middleware to specific route
    ....
    $app->put('/user/{id}')->to(UserController::class, 'update')->middlewares([
        new AuthenticateMiddleware()
    ]);
    $app->router->addRoute(
        Route::put('/user/{id}')->to(UserController::class, 'update')->middlewares([
            new AuthenticateMiddleware()
        ])
    );
    ....
```

Bindings
--------

[](#bindings)

Bind an interface to a particular class. Hence, the specified class object will be used when resolving dependencies.

### Add Binding

[](#add-binding)

```
    ....
    $app = new App($config);
    $app->addBinding(CacheInterface::class, RedisCache::class)
    ....
```

### Resolve Binding

[](#resolve-binding)

```
    // Manually
    $cache = app()->make(CacheInterface::class)

    // Automatically
    class UserController
    {
        public function __construct(private CacheInterface $cache)
        {
        }
    }
```

Views
-----

[](#views)

### Generic Component

[](#generic-component)

Add view file to your view path. E.g `myapp/Views/login.php`

```
    # In Controller (or anywhere you wish to load view)
    // Using app instance
    app()->loader->view('login', ['username' => $uname, 'password' => $pass]);
    // Using helpers
    view('login', ['username' => $uname, 'password' => $pass]);
```

### Dedicated View Model

[](#dedicated-view-model)

Add view file(s) to your view path. E.g `myapp/Views/LoginPage.php`, `myapp/Views/components/login.php`

```
    # In-line rendering
    class LoginPage extends View
    {
        public function __construct(protected LoginPageDto|BaseDto|array|null $data = null, protected $headers = array())
        {
        }

        public function render()
        {
            $header = new HeaderComponent;
            return include('components/login', true);
        }
    }
```

Database *(Armie ORM)*
----------------------

[](#database-armie-orm)

A simple but expressive database object-relational mapper (ORM) built on top of PHP Data Objects (PDO)

### Define Model

[](#define-model)

```
class ProductModel extends Model
{
    /**
     * @inheritDoc
     */
    public function getFields(): array
    {
        return [
            new Field('id', DataType::INT),
            new Field('name', DataType::STRING),
            new Field('type', DataType::STRING),
            new Field('qty', DataType::INT),
            new Field('categoryId', DataType::INT),
            new Field('createdAt', DataType::DATETIME),
            new Field('updatedAt', DataType::DATETIME),
            new Field('deletedAt', DataType::DATETIME)
        ];
    }
    /**
     * @inheritDoc
     */
    public function getRelations(): array
    {
        return [
            new OneToOne('category', $this, new Reference(CategoryTestModel::class, ['categoryId' => 'id']))
        ];
    }
    /**
     * @inheritDoc
     */
    public function getTableName(): string
    {
        return 'products';
    }
    /**
     * @inheritDoc
     */
    public function getKeyName(): ?string
    {
        return 'id';
    }
    /**
     * @inheritDoc
     */
    public function getCreatedDateName(): ?string
    {
        return 'createdAt';
    }
    /**
     * @inheritDoc
     */
    public function getUpdatedDateName(): ?string
    {
        return 'updatedAt';
    }
    /**
     * @inheritDoc
     */
    public function getSoftDeleteDateName(): ?string
    {
        return 'deletedAt';
    }
}
```

#### Save Model

[](#save-model)

```
$model = ProductModel::create(['name' => 'IPhone 14', 'qty' => 3, 'type' => 'Mobile Phone', 'categoryId' => 1]);
$model = ProductModel::update(1, ['name' => 'IPhone 14', 'qty' => 3, 'type' => 'Mobile Phone', 'categoryId' => 1]);
// Or
...
$product = new ProductModel;
$product->load(['name' => 'IPhone 14', 'qty' => 3, 'type' => 'Mobile Phone', 'categoryId' => 1]);
$product->save();
```

#### Find Item

[](#find-item)

```
...
$model = ProductModel::findById(1);
// Or
$model = (new ProductModel)->find(1);
```

#### Get List

[](#get-list)

```
...
$model = ProductModel::getAll();
// Or
$model = (new ProductModel)->all();
```

### Define Repository

[](#define-repository)

```
class ProductRepository extends Repository
{
    public function __construct()
    {
        parent::__construct(new ProductModel);
    }
}
// Or - Use Generic Repository
$productRepo = new Repository(new ProductModel)
```

#### Get Paginated List

[](#get-paginated-list)

```
...
$productRepo = new ProductRepository();
$result = $productRepo->paginate(1, 3);
```

Tests
-----

[](#tests)

To execute the test suite, you'll need to install all development dependencies.

```
$ git clone https://github.com/busarm/armie
$ composer install
$ composer test
```

You can use PHP server built-in server to test:

```
$ php -S localhost:8181 -t tests/app/v1
```

License
-------

[](#license)

The Armie Framework is licensed under the MIT license. See [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% 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 ~3 days

Total

10

Last Release

1018d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/067deadf94c58bce1f83076a6b7120a0b2bebc9f00ba456ef104412c3963e0b5?d=identicon)[Gadana1](/maintainers/Gadana1)

---

Top Contributors

[![sagadana](https://avatars.githubusercontent.com/u/25706510?v=4)](https://github.com/sagadana "sagadana (159 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

asynchronousevent-driveneventsframeworkmicroservicephpqueueworkermanphpevent-loopasynchronousframeworkMicroservice

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/busarm-armie/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M571](/packages/shopware-core)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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