PHPackages                             osmphp/framework - 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. osmphp/framework

AbandonedArchivedLibrary[Framework](/categories/framework)

osmphp/framework
================

Osm Framework is an open-source, insanely fast, unprecedentedly extensible, and fun to work with PHP 8 framework for creating modern Web applications. It's built on top of tried and tested Symfony and Laravel components.

v0.15.17(3y ago)55273GPL-3.0-onlyPHPPHP &gt;=8.0

Since Dec 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/osmphp/framework)[ Packagist](https://packagist.org/packages/osmphp/framework)[ RSS](/packages/osmphp-framework/feed)WikiDiscussions v0.15 Synced 1w ago

READMEChangelog (9)Dependencies (19)Versions (119)Used By (3)

 [![Build Status](https://github.com/osmphp/framework/workflows/tests/badge.svg)](https://github.com/osmphp/framework/actions) [![Total Downloads](https://camo.githubusercontent.com/adf9b91ffcfcf3924120733992ac72a1bd3338aa2d532f187b419dd1e1bae0fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f736d7068702f6672616d65776f726b)](https://packagist.org/packages/osmphp/framework) [![Latest Stable Version](https://camo.githubusercontent.com/23eb2bc92e02735b49da0e3a83f6a54b9e753af1280cd336d2fdf164df8969b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f736d7068702f6672616d65776f726b)](https://packagist.org/packages/osmphp/framework) [![License](https://camo.githubusercontent.com/cb08883086fff742dee3397dd563b69b920a19b2607c907058c115cd85154c99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f736d7068702f6672616d65776f726b)](https://packagist.org/packages/osmphp/framework)

Osm Framework is an open-source, insanely fast, unprecedentedly extensible, and fun to work with PHP 8 framework for creating modern Web applications. It's built on top of tried and tested Symfony and Laravel components.

Documentation
=============

[](#documentation)

- Getting Started
    - [Introduction](https://osm.software/blog/21/05/framework-introduction.html)
    - [Installation](https://osm.software/blog/21/08/framework-installation.html)
    - [Command Line Aliases](https://osm.software/blog/21/08/framework-command-line-aliases.html)
    - Directory Structure
    - Using Gulp
    - Nginx
    - Apache
- Writing PHP Code
    - [Computed Properties](https://osm.software/blog/21/09/framework-computed-properties.html)
    - [Modules](https://osm.software/blog/21/09/framework-modules.html)
    - [Dynamic Traits](https://osm.software/blog/21/09/framework-dynamic-traits.html)
    - [Application](https://osm.software/blog/21/09/framework-application.html)
    - Hint Classes
    - Reflection
    - Testing
    - PHPStorm
- Creating Web Applications
    - Requests
    - Routes
    - Areas
    - Advices
    - Responses
    - Views And Components
    - Themes
    - Assets
- Creating Console Applications
- Processing Data
    - Migrations
    - Database
    - [Search](https://osm.software/blog/21/05/framework-search.html)
- Writing JavaScript Code
    - Classes
    - Controllers
    - Testing
- Other Features
    - [Logging](https://osm.software/blog/21/09/framework-logging.html)
    - Caching
    - Configuration
    - Translations
    - Maintenance Mode
    - Production Mode
    - Helper Functions
    - Extending Gulp Scripts
- [License](https://github.com/osmphp/framework/blob/HEAD/LICENSE)

Top Features
============

[](#top-features)

Extensibility (Dynamic Traits)
------------------------------

[](#extensibility-dynamic-traits)

Let's examine the extensibility bit in more detail.

Imagine using some e-commerce software that processes new sales order as follows:

```
class Order extends Object_ {
    public function submit(): void {
        $this->validate();
        $this->applyDiscounts();
        $this->applyTaxes();
        $this->save();
    }

    protected function validate(): void {
        // standard validation logic
        ...
    }

    ...
}

```

If you need to customize this logic, for example, check if all the purchased items are in stock, you can add it after the validation phase:

```
trait OrderTrait {
    protected function around_validate(callable $proceed): void {
        // first, execute the standard validation
        $proceed();

        // then, add the logic that checks the stock
        ...
    }
}

```

Under the hood, Osm Framework applies this PHP trait dynamically to `Order` class, and overrides standard `validate()` method with your custom `around_validate()` method.

This way, you can customize any method, in almost any class.

You can introduce new properties and methods to existing classes, too:

```
/**
 * @property bool @are_all_items_in_stock
 */
trait OrderTrait {
    protected function checkStockItem(): bool {
        ...
    }
}

```

Fast And Test-Friendly Computed Properties
------------------------------------------

[](#fast-and-test-friendly-computed-properties)

In Osm Framework, a **computed (or "lazy") property** is a public property of a PHP class that is computed once on first access using matching `get_` method.

For example, consider a class that reads and transforms a Markdown file into HTML:

```
/**
 * @property string $path Relative file path in the `data` directory.
 *      Provide this property in the constructor.
 * @property string $absolute_path Absolute file path
 *
 * @property string $text Original text in Markdown format
 * @property string $html Text converted to HTML
 */
class MarkdownFile extends Object_ {
    protected function get_absolute_path(): string {
        // get the reference to the global application object which,
        // among other things, stores the absolute path of the `data`
        // directory in its `paths->data` property
        global $osm_app; /* @var App $osm_app */

        return "{$osm_app->paths->data}/posts/{$this->path}";
    }

    protected function get_text(): string {
        return file_get_contents($this->absolute_path);
    }

    protected function get_html(): ?string {
        // convert the text into HTML using `michelf/php-markdown`
        // Composer package
        return MarkdownExtra::defaultTransform($this->text);
    }
}

```

Typical usage:

```
// `MarkdownFile::new()` creates new instance of the class,
// just as `new MarkdownFile()` would do, plus it applies dynamic traits
$file = MarkdownFile::new(['path' => 'welcome.md']);

echo $file->html;

```

While accessing formally undefined `html` property for the first time, PHP internally creates it and assigns it a value computed using `get_html()` method. On subsequent access, PHP just returns previously computed property value. The same happens with `text` and `absolute_path` properties.

Computed properties save precious CPU cycles. On one hand, property values are only computed if they are actually accessed. On the other hand, some properties are accessed hundreds or even thousands times while handling a single HTTP request, and thanks to very fast subsequent access these properties have significant performance increase.

Computed properties are also test-friendly. In the following example, the unit test fully concentrates on HTML transformation by omitting `text` property computation - and all the file handling - by providing its value in the constructor:

```
public function test_markdown_transformation() {
    // GIVEN a bold text written in Markdown
    $file = MarkdownFile::new(['text' => '**test**']);

    // WHEN you convert it to HTML
    // THEN it is marked with `` HTML element
    $this->assertEquals('test', $file->html);
}

```

More Results With Less Effort Using Reflection
----------------------------------------------

[](#more-results-with-less-effort-using-reflection)

With Osm Framework, you develop faster by letting it to infer mundane things from class definitions.

For example, in order to introduce new console command, you only have to define a class extending the `Command` class, and the framework adds it to the system automatically. It also inspects property definitions, finds the `Option` and `Argument` attributes, and exposes them as command-line options and arguments:

```
/**
 * @property bool $caps #[Option] If specified, the person name is upper-cased
 * @property string $person_name #[Argument] The person to greet
 */
class Hello extends Command
{
    public string $name = 'hello';
    public string $description = 'A sample command';

    public function run(): void {
        $name = $this->caps ? strtoupper($this->person_name) : $this->person_name;
        $this->output->writeln("Hello, {$name}");
    }
}

```

With the `gulp watch` running, you can use the command without further ado:

```
>osm hello vo
Hello, vo

>osm hello vo --caps
Hello, VO

```

The other example stores the property in the application cache just by marking property as `Cached`:

```
/**
 * @property string $cached_property #[Cached('my_cache_entry')]
 */
class MyClass extends Object_
{
    protected function get_cached_property(): string {
        ...
    }
}

```

Exceptional Performance
-----------------------

[](#exceptional-performance)

Osm Framework is very fast, for two reasons.

First, it offloads performance-hungry parts into pre-execution (or "compilation") phase, and aggressively uses caching techniques.

Second, where it really makes a difference, it puts performance first, sometimes even above established programming practices.

One example is implementation of computed properties. The implementation is really fast, but it sacrifices encapsulation principle - the computed properties are public.

Another example is `$osm_app` global variable. Global variables in general are a known anti-pattern. However, as tests have shown, replacing `get_app()` accessor function with direct variable access gives significant performance boost, and, hence, the `$osm_app`global variable became the main internal API entry point.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% 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 ~4 days

Recently: every ~9 days

Total

116

Last Release

1449d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/70505ad13b7a3f67344988bd0f17f6a5c6bc29919300c7e12d937882eebc3080?d=identicon)[osmianski](/maintainers/osmianski)

---

Top Contributors

[![osmianski](https://avatars.githubusercontent.com/u/522822?v=4)](https://github.com/osmianski "osmianski (552 commits)")[![vo-manadev](https://avatars.githubusercontent.com/u/1670015?v=4)](https://github.com/vo-manadev "vo-manadev (97 commits)")

---

Tags

frameworkosmframeworkosmphposmsoftwarephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/osmphp-framework/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

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

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[laravel/lumen-framework

The Laravel Lumen Framework.

1.5k26.2M709](/packages/laravel-lumen-framework)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-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)
