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

ActiveLibrary[Framework](/categories/framework)

beauty-framework/core
=====================

Beauty core

1.0.4(11mo ago)0172MITPHPPHP &gt;=8.1

Since Jun 10Pushed 11mo agoCompare

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

READMEChangelog (5)Dependencies (10)Versions (6)Used By (2)

Beauty Core
===========

[](#beauty-core)

The `beauty-framework/core` package is the foundation of the Beauty Framework — a PSR-compliant, high-performance runtime for building clean and maintainable REST and gRPC (todo) services. It brings together routing, middleware, dependency injection, event system, and configuration management into a modular and lightweight package optimized for use with RoadRunner.

Features
--------

[](#features)

- Clean architecture: Separation of concerns, modular components.
- PSR standards: PSR-7, PSR-11, PSR-14, PSR-15 compliance.
- Route registration via PHP Attributes.
- Simple and extendable DI container using `php-di`.
- Attribute-based and runtime middleware pipeline.
- Event dispatcher and listener registration (PSR-14 compatible).
- Lightweight config system with runtime registry.
- CLI kernel with support for custom commands.

---

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

[](#installation)

```
composer require beauty-framework/core
```

---

Usage
-----

[](#usage)

### App Kernel

[](#app-kernel)

`Kernel\App` is the main entry point for your application. It boots the container, registers routes, middleware, events, and config, and starts request handling.

```
use Beauty\Kernel\App;

require 'vendor/autoload.php';

$container = ContainerManager::bootFrom([
    \App\Container\Base::class,
    \App\Container\DI::class,
]);

$app = new App(
    container: $container,
);

$app->handle($request);
```

See in `workers/http-worker.php` in `beauty-framework/app` for a real-world example.

---

Routing System
--------------

[](#routing-system)

`beauty-framework/core` includes an attribute-driven router with support for method-based route definitions and route-specific middleware.

### Basic Example

[](#basic-example)

```
use Beauty\Core\Router\Route;

class UserController
{
    #[Route(method: \Beauty\Http\Enums\HttpMethodsEnum::GET, path: '/users')]
    public function index(HttpRequest $request): \Psr\Http\Message\ResponseInterface
    {
        return new JsonResponse(200, [
            'name' => $request->json('name'),
        ]);
    }
}
```

Generate via CLI:

```
./beauty generate:controller UserController
```

```
./beauty generate:request UserRequest
```

---

Dependency Injection (Container)
--------------------------------

[](#dependency-injection-container)

The framework uses a custom `ContainerManager` that wraps `php-di` and provides:

- Singleton bindings
- Auto-wiring
- Runtime container access via `ContainerRegistry`
- `ContainerAwareInterface` for injecting container where needed

```
use Beauty\Container\ContainerManager;

$container = ContainerManager::bootFrom([
    \App\Container\Base::class,
    \App\Container\DI::class,
]);

$service = $container->get(SomeService::class);
```

---

Configuration
-------------

[](#configuration)

Configuration is loaded from PHP files in `config/*.php`, and accessed via `config` function:

```
use Beauty\Config\ConfigRepository;

$config = config('app.debug');
```

At runtime, the `ConfigRegistry` provides in-memory updates or overrides.

---

Event System
------------

[](#event-system)

`beauty-framework/core` ships with a PSR-14-compatible event dispatcher. You can define events and listeners:

### Event

[](#event)

```
class UserRegisteredEvent
{
    public function __construct(
        public string $email
    ) {}
}
```

### Listener

[](#listener)

```
class SendWelcomeEmailListener
{
    public function handle(UserRegisteredEvent $event): void
    {
        // Send email
    }
}
```

### Registering

[](#registering)

Use `ListenerRegistry`:

Or generate via CLI:

```
./beauty generate:event UserRegistered
./beauty generate:listener SendWelcomeEmail
```

---

🧵 Middleware
------------

[](#-middleware)

The router supports global and route-specific middleware using PSR-15-style interfaces.

```
use Beauty\Http\Middleware\MiddlewareInterface;

class AuthMiddleware implements MiddlewareInterface
{
    public function process(HttpRequest $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // Auth check
        return $handler->handle($request);
    }
}
```

You can also use attributes like `#[Middleware([AuthMiddleware::class])]` on controller classes or methods.

Generate with stubs:

```
./beauty generate:middleware Hello
```

---

CLI Kernel
----------

[](#cli-kernel)

Define and register commands in `config/commands.php`, and they’ll be loaded automatically by the console kernel:

```
class SomeCommand extends AbstractCommand
{
    protected string $name = 'hello';

    public function handle(array $args): int
    {
        $this->line('Hello, world!');

        return CLI::SUCCESS;
    }
}
```

Or generate with stubs:

```
./beauty generate:command Hello
```

---

Testing
-------

[](#testing)

Coming soon: feature and unit tests for routing, DI, config, and event dispatching.

---

PSR Compliance
--------------

[](#psr-compliance)

StandardStatusPSR-1✅PSR-4✅PSR-7✅PSR-11✅PSR-15✅PSR-14✅---

Helpers
-------

[](#helpers)

- `helpers/di.php` – short helpers to access DI bindings.
- `helpers/env.php` – `.env` parsing and usage functions.

---

License
-------

[](#license)

MIT

---

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

[](#contributing)

Pull requests and discussions are welcome! Let's make this the most developer-friendly framework for building modern PHP services.

---

Related Modules
---------------

[](#related-modules)

- [`beauty-framework/http`](https://github.com/beauty-framework/http): PSR-7 request/response wrappers
- [`beauty-framework/validation`](https://github.com/beauty-framework/validation): Laravel-like request validation
- [`beauty-framework/database`](https://github.com/beauty-framework/database): Lightweight query builder
- [`beauty-framework/cache`](https://github.com/beauty-framework/cache): PSR-6 cache adapter
- [`beauty-framework/jobs`](https://github.com/beauty-framework/jobs): Fiber-based job runner with RoadRunner support
- [`beauty-framework/cli`](https://github.com/beauty-framework/cli): Framework-aware CLI kernel
- [`beauty-framework/parallels`](https://github.com/beauty-framework/parallels): Parallel processing with Fibers (todo: RoadRunner)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance51

Moderate activity, may be stable

Popularity6

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

Every ~0 days

Total

5

Last Release

341d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/068f8c26f06f513a9c38d2a01c4d90a85eae1125a5b9d14eae7059715be860e4?d=identicon)[m1n64](/maintainers/m1n64)

---

Top Contributors

[![m1n64](https://avatars.githubusercontent.com/u/24874264?v=4)](https://github.com/m1n64 "m1n64 (7 commits)")

---

Tags

corebeauty

### Embed Badge

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

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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