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

ActiveLibrary[Framework](/categories/framework)

stormmore/framework
===================

161PHP

Since Oct 27Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/boltwebengine/storm-php-framework)[ Packagist](https://packagist.org/packages/stormmore/framework)[ RSS](/packages/stormmore-framework/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

⚡ StormPHP Framework
====================

[](#-stormphp-framework)

Built with love to deliver joy and satisfaction with every piece of code you write. StormPHP is designed to be **intuitive, lightweight, and blazing fast** — the simplest app takes just **4 lines of code**.

Despite its minimal footprint (~100KB, zero dependencies), it provides a **rich set of features** to help you build modern PHP applications.

---

✨ Features
----------

[](#-features)

- Easy to learn — start coding in minutes
- Tiny footprint (~100KB, no dependencies)
- Blazing fast
- Built-in Dependency Injection Container
- Built-in Middleware Pipeline
- **Command Query Separation (CQS)**
- Event Dispatcher
- Multilingual (i18n) support
- Authentication &amp; Authorization
- Logger
- Autoloader with class scanning
- Path alias system (`@templates/homepage.php`)
- Mature PHP-based view system (layouts, child views, CSS/JS injection)
- Validation &amp; Forms
- Mailing (i18n, SMTP client)
- CLI tasks &amp; controller execution
- End-to-end tests via PHPUnit
- Error customization
- Docker ready
- PHP 8+ support
- Works with **StormPHP Queries**

---

🚀 Hello World
-------------

[](#-hello-world)

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

$app = App::create();
$app->addRoute('/', fn() => "Hello, world!");
$app->run();
```

---

⚡ Quick Start
-------------

[](#-quick-start)

### Installation

[](#installation)

#### Composer

[](#composer)

```
composer require stormmore/framework
```

In your `index.php`:

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

#### Standalone

[](#standalone)

Download the ZIP package, extract `src/`, and include the autoloader:

```
require 'YOUR/PATH/TO/STORM/src/autoload.php';
```

---

📂 Project Structure
-------------------

[](#-project-structure)

A typical application layout:

```
my_app/
├── .cache/         # cached metadata
├── .logs/          # log files
├── public_html/    # public web root
│   ├── index.php
│   ├── app.css
│   └── app.js
├── src/            # application source
│   ├── MyController.php
│   ├── Database.php
│   └── templates/
│       └── view.php
└── README.md

```

---

🛠 Key Concepts
--------------

[](#-key-concepts)

### Class Scanning

[](#class-scanning)

Storm automatically scans your `src/` directory for controllers, tasks, and classes. In **production**, it uses a `.cache` file for performance.

### Autoloading

[](#autoloading)

Namespaces map directly to file paths:

```
use Infrastructure\Images\Resize;
```

→ loads `src/infrastructure/images/resize.php`.

### Routing

[](#routing)

Controllers are discovered automatically via the `#[Route]` attribute. No manual registration required.

### Middleware

[](#middleware)

Every request flows through a middleware pipeline. You can plug in your own middleware at any stage.

### Aliases

[](#aliases)

Aliases make path management easier:

```
$app->addMiddleware(AliasMiddleware::class, [
    '@templates' => "@/src/templates"
]);
```

### Configuration

[](#configuration)

Optional but recommended for larger apps:

```
$app = App::create(directories: [
  'project' => '../',
  'source'  => '../src',
  'cache'   => '../.cache',
  'logs'    => '../.logs'
]);
```

---

🎮 Example Controller
--------------------

[](#-example-controller)

```
namespace App;

use Stormmore\Framework\Mvc\Attributes\Controller;
use Stormmore\Framework\Mvc\Attributes\Route;
use Stormmore\Framework\Mvc\View\View;

#[Controller]
readonly class HomepageController
{
    #[Route("/")]
    public function index(): View
    {
        return view("@templates/homepage");
    }
}
```

Supports:

- **Dependency Injection** (via constructor)
- **HTTP Methods**: `#[Get]`, `#[Post]`, `#[Put]`, `#[Delete]`
- **Query &amp; Path Parameters**
- **Responses**: `View`, `Redirect`, JSON objects, primitives

---

🎨 Views
-------

[](#-views)

Storm views are plain PHP files, but with helpers for layouts, assets, and dynamic rendering.

**Layout Example**:

```
DOCTYPE html>

```

**Template Example**:

```
