PHPackages                             thinframe/karma - 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. thinframe/karma

ActiveLibrary

thinframe/karma
===============

Experimental HTTP server written in PHP

v0.2.1(12y ago)2591[1 PRs](https://github.com/thinframe/karma/pulls)MITPHPPHP &gt;=5.4.0

Since Jan 26Pushed 12y ago4 watchersCompare

[ Source](https://github.com/thinframe/karma)[ Packagist](https://packagist.org/packages/thinframe/karma)[ Docs](http://thinframe.net)[ RSS](/packages/thinframe-karma/feed)WikiDiscussions master Synced 2mo ago

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

\#Karma

New generation of PHP frameworks

[![Latest Stable Version](https://camo.githubusercontent.com/314b1ce269933991116f291a4c9c316b556c3cfde3bd1146ca64ebaa1e90a4bc/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6672616d652f6b61726d612f762f737461626c652e706e67)](https://packagist.org/packages/thinframe/karma)[![Latest Unstable Version](https://camo.githubusercontent.com/c3742c184eea38dfe9767269d7340a0d4486a2faf3408dd4de967933b1bd4593/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6672616d652f6b61726d612f762f756e737461626c652e706e67)](https://packagist.org/packages/thinframe/karma)[![License](https://camo.githubusercontent.com/fb431cc8d7587b27d92f885b66c298a66afffc5d997725e4f50a1acba1343aaa/68747470733a2f2f706f7365722e707567782e6f72672f7468696e6672616d652f6b61726d612f6c6963656e73652e706e67)](https://packagist.org/packages/thinframe/karma)

\##What is the problem with the current generation?

To explain the current problem let me start with a simple description on how PHP websites work:

1. A user makes a request from his browser to a certain website that is running using PHP
2. The HTTP server accepts that request and handles it in different ways:

    - Apache executes the PHP script associated with the requested path directly and returns the output
    - Nginx uses PHP-FPM to do basically the same thing.
3. The HTTP server sends the response back to the client

All good so far, but let's look a little bit deeper. When a PHP script is executed the followings things take place:

1. The necessary dependencies are loaded, lazy or all at once, and all the components are configured/initialized.
2. Your logic is executed depending on the request and a response is returned.

But there is a problem in this process, because one of those two steps is executed every single time. Oh well ...

Step 1 is executed for every single request, and from my point of view that is a bottleneck of PHP applications, since IO operations are very expensive.

\##Solutions that already exists

- Use bootstrap files like Symfony2 do.
- Investing in hardware. This is a good solution if you have the MONEY.
- OPcache
- And so on ...

\##A new aproach ... ?

Tom &amp; David Kelley, the authors of the book `Creative Confidence` and owners of the company `IDEO`, say in their book that the best solution to an existing problem is to rethink the whole process that causes that problem. But the problem in this case is by design. PHP was made this way, right ?

The solution
------------

[](#the-solution)

Some time ago, I came across `ReactPHP`, it is a PHP library that offers Event-driven, non-blocking I/O. It is inspired from NodeJS and it is awesome. I played with it, I did some tests and then an idea came to my mind:

Instead of using two programs to do one thing, the HTTP server and the PHP, why don't we use a single one that will act as both?

Basically, we merge the HTTP server, and the PHP framework that is behind the server, to make a single program written in PHP that will do both tasks. This way we will eliminate the recurrent loading/initialization time for PHP dependencies and also save some time that is lost between the HTTP server and PHP.

Painfull ? Not at all.

\##Karma

It is a `PHP Application` that acts as an HTTP server and a PHP framework, all at the same time. It provides an easy to use abstraction layer over anything that relates to socket work, so developers can focus on their work. It is fast, with a response time that is 80 to 90 percent faster than a conventional framework and it works with already existing PHP components, like Twig.

It provides built-in routing using `Symfony Routing` component and all the architecture is build around `Symfony Dependency Injection Container`. Most of the socket work is handled by the `ReactPHP` component. Basically, it is built with already existing PHP components.

\##Installation

```
composer create-project thinframe/karma-project  --stability=dev

```

If you want to use the command line component with completion support execute the following command in your project root:

```
bash bin/thinframe-installer

```

From this point on, you can use the `thinframe` command in each karma project folder that you have. Otherwise, you can use `bin/thinframe` instead of `thinframe`.

\##Usage

To see all available commands execute the following command: `thinframe help`. Pretty simple.

```
  help                   - Show this list

  server run             - Start the HTTP server

  server run --daemon    - Start the HTTP server as a daemon

  server stop            - Stop the HTTP server

  server status          - Check HTTP server status

  server restart         - Restart the HTTP server

  server monitor         - Restart the HTTP server when source files are changed

  debug routes           - Show all routes

  debug applications     - Show all loaded applications

```

The test the setup, run `thinframe server start` and in your browser go to `http://localhost:1337`. If you see a default Karma page, then everything works.

By default, when you install `karma-project`, it creates a bootstrap project. All project related files are located in `src/Acme/DemoApp`.

\[to be continued ...\]

\##TODO's

- Write unit tests and functional tests
- Optimize memory
- More documentation
- Implement PsySH
- More logging
- All kinds of features
- Test on all Linux distributions.

\##OS Support

So far it was tested on Ubuntu and Elementary OS. It should work on other Linux distributions pretty well.

\##Dependencies

- PHP &gt;= 5.4
- ext-inotify -

\##Fair warning

This project is experimental. I recommend that it shouldn't be used on a production environment (yet).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

4491d ago

### Community

Maintainers

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

---

Top Contributors

[![unusorin](https://avatars.githubusercontent.com/u/1003231?v=4)](https://github.com/unusorin "unusorin (51 commits)")

---

Tags

phphttp serverthinframekarma

### Embed Badge

![Health badge](/badges/thinframe-karma/health.svg)

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

PHPackages © 2026

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