PHPackages                             progrmanial/helix - 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. progrmanial/helix

ActiveLibrary[Framework](/categories/framework)

progrmanial/helix
=================

Helix is a PHP library designed to simplify the development of web applications by providing a set of tools and utilities for common tasks such as routing, middleware handling, and dependency injection.

v1.0.5(5mo ago)0103MITPHPPHP ^8.2

Since Jun 1Pushed 5mo agoCompare

[ Source](https://github.com/imransaadullah/helix)[ Packagist](https://packagist.org/packages/progrmanial/helix)[ RSS](/packages/progrmanial-helix/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (11)Versions (8)Used By (0)

Helix
=====

[](#helix)

[![PHP Version](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)[![Tests](https://camo.githubusercontent.com/d940ad7f0752e2cbe0d63c50dcebf329078807390051c41fe63258f1b5c4e182/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d627269676874677265656e)](https://camo.githubusercontent.com/d940ad7f0752e2cbe0d63c50dcebf329078807390051c41fe63258f1b5c4e182/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d627269676874677265656e)

Helix is a modern PHP library designed to simplify web application development by providing a robust set of tools and utilities for common tasks. It focuses on providing a modular, multi-tenant application framework with strong emphasis on security and flexibility.

Quick Start
-----------

[](#quick-start)

```
use Helix\Core\Container\HelixContainer;
use Helix\Routing\Router;
use Helix\Http\Response;

$router = new Router(new HelixContainer());
$router->get('/', fn() => new Response(200, ['Hello, Helix!']));
```

Features
--------

[](#features)

- **Plugin Architecture**: Dynamic functionality extensions
- **Role-Based Access Control (RBAC)**: Built-in security with policy engine
- **Hybrid Deployment Support**: Flexible deployment options (SaaS, on-premise, and edge)
- **Modern Architecture**:
    - Custom PSR-11 compliant Dependency Injection Container
    - Event-driven architecture with hooks
    - Multi-tenant support with container-level isolation
    - Phase-based initialization system

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

[](#requirements)

- PHP 8.2 or higher
- JSON PHP Extension
- Composer

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

[](#installation)

Install Helix using Composer:

```
composer require progrmanial/helix
```

Component Usage Guide
---------------------

[](#component-usage-guide)

### Dependency Injection Container

[](#dependency-injection-container)

The container implements PSR-11 and provides advanced dependency management:

```
use Helix\Core\Container\HelixContainer;

$container = new HelixContainer();

// Simple binding
$container->add(LoggerInterface::class, FileLogger::class);

// Singleton binding
$container->singleton(Database::class, function() {
    return new Database('connection_string');
});

// Factory binding
$container->factory(Request::class, function() {
    return Request::createFromGlobals();
});

// Contextual binding
$container->when(UserController::class)
    ->needs(LoggerInterface::class)
    ->give(function() {
        return new FileLogger('users.log');
    });

// Resolving dependencies
$userController = $container->get(UserController::class);
```

### Database ORM

[](#database-orm)

The database layer provides an intuitive Active Record pattern implementation:

```
use Helix\Database\Model;
use Helix\Database\Relations\HasMany;

class User extends Model
{
    protected static string $table = 'users';
    protected static bool $timestamps = true;
    protected static bool $softDeletes = true;

    public function posts(): HasMany
    {
        return $this->hasMany(Post::class);
    }
}

// Create
$user = User::create([
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);

// Read
$user = User::find(1);
$activeUsers = User::where('status', '=', 'active')->get();

// Update
$user->name = 'Jane Doe';
$user->save();

// Delete
$user->delete();

// Relationships
$userPosts = $user->posts()->where('status', '=', 'published')->get();

// Soft deletes & restore
$trashed = User::withTrashed()->find($user->getKey());
$trashed->restore();

// Eager loading
$users = User::query()->with('posts.comments')->get();
```

### Query Builder

[](#query-builder)

For more complex queries, use the fluent query builder:

```
use Helix\Database\QueryBuilder;

$users = QueryBuilder::table('users')
    ->select(['id', 'name', 'email'])
    ->where('status', '=', 'active')
    ->where(function($query) {
        $query->where('role', '=', 'admin')
              ->orWhere('role', '=', 'moderator');
    })
    ->orderBy('created_at', 'DESC')
    ->limit(10)
    ->get();

// Joins
$posts = QueryBuilder::table('posts')
    ->join('users', 'posts.user_id', '=', 'users.id')
    ->where('users.status', '=', 'active')
    ->select(['posts.*', 'users.name as author'])
    ->get();
```

### Router &amp; Middleware

[](#router--middleware)

The routing system supports clean and flexible route definitions:

```
use Helix\Routing\Router;
use Helix\Http\Request;
use Helix\Http\Response;

$router = new Router($container);

// Basic routes
$router->get('/', [HomeController::class, 'index']);
$router->post('/users', [UserController::class, 'store']);

// Route groups
$router->group('/api', function(Router $router) {
    $router->group('/v1', function(Router $router) {
        $router->get('/users', [UserApiController::class, 'index']);
        $router->post('/users', [UserApiController::class, 'store']);
    }, ['api.auth']); // Apply middleware to group
});

// Custom middleware
class AuthMiddleware
{
    public function handle(Request $request, callable $next): Response
    {
        if (!$request->hasValidToken()) {
            return new Response(401, ['Unauthorized']);
        }
        return $next($request);
    }
}

$router->addMiddleware('auth', AuthMiddleware::class);
```

### Event System

[](#event-system)

The event system enables loose coupling between components:

```
use Helix\Events\Dispatcher;
use Helix\Events\Event;

class UserRegistered extends Event
{
    public function __construct(public readonly User $user) {}
}

// Register listeners
$dispatcher = new Dispatcher();
$dispatcher->addListener(UserRegistered::class, function(UserRegistered $event) {
    // Send welcome email
    $mailer->sendWelcomeEmail($event->user);
});

// Dispatch events
$dispatcher->dispatch(new UserRegistered($user));
```

### Configuration Management

[](#configuration-management)

Handle configuration with environment support:

```
use Helix\Core\Conf\ConfigLoader;

$config = new ConfigLoader();

// Load configuration
$config->load(
    envFile: '.env',
    configFiles: [
        'config/database.php',
        'config/app.php'
    ],
    useEnvironmentSuffix: true
);

// Access configuration
$dbHost = $config->get('database.host');
$appName = $config->get('app.name', 'Helix App'); // With default value
```

### Multi-tenancy

[](#multi-tenancy)

Handle multiple tenants in your application:

```
use Helix\Database\ConnectionManager;

// Setup connections
$manager = new ConnectionManager();
$manager->addConnection(
    'tenant1',
    'mysql://localhost/tenant1_db',
    'user',
    'password',
    ['charset' => 'utf8mb4']
);

// Switch connections
Model::setConnection($manager->getConnection('tenant1'));
```

Testing
-------

[](#testing)

Run the automated test suite after installing dependencies:

```
composer install
vendor/bin/phpunit
```

> **Note:** The database integration tests rely on the PDO SQLite driver. If it is not available, the suite will automatically skip those tests.

Dependencies
------------

[](#dependencies)

### Core Dependencies

[](#core-dependencies)

- firebase/php-jwt: JWT authentication
- guzzlehttp/psr7: PSR-7 HTTP message implementation
- monolog/monolog: Logging
- symfony/event-dispatcher: Event handling
- vlucas/phpdotenv: Environment configuration
- ramsey/uuid: UUID generation

### Development Dependencies

[](#development-dependencies)

- phpunit/phpunit: Testing
- phpstan/phpstan: Static analysis
- mockery/mockery: Mocking framework
- vimeo/psalm: Static analysis
- friendsofphp/php-cs-fixer: Code style fixing

Standards Compliance
--------------------

[](#standards-compliance)

- PSR-4 (Autoloading)
- PSR-11 (Container Interface)
- PSR-12 (Coding Style)
- OWASP Top 10 security guidelines
- GDPR Article 32 compliance

License
-------

[](#license)

This project is licensed under the MIT License.

Author
------

[](#author)

- **Imran Saadullah** -

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Keywords
--------

[](#keywords)

PHP, Library, Web Application Development, Routing, Middleware, Dependency Injection

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance70

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

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 ~35 days

Recently: every ~44 days

Total

6

Last Release

174d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c3b97aa4b1e51da921dcb5e78d4a4586d1850bd98eaaa2b3388b6f44a19d79?d=identicon)[imransaadullah](/maintainers/imransaadullah)

---

Top Contributors

[![imransaadullah](https://avatars.githubusercontent.com/u/48366039?v=4)](https://github.com/imransaadullah "imransaadullah (10 commits)")

---

Tags

phpmiddlewarewebdependency-injectionlibraryroutingdevelopmentapplication

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/progrmanial-helix/health.svg)

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

###  Alternatives

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[yiisoft/router

Yii router

62321.8k21](/packages/yiisoft-router)[yiisoft/yii-middleware

Yii Middleware

21151.3k1](/packages/yiisoft-yii-middleware)

PHPackages © 2026

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