PHPackages                             globus-studio/atom - 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. globus-studio/atom

ActiveLibrary[Framework](/categories/framework)

globus-studio/atom
==================

Atom - PHP 8.5 micro-framework. Single PCRE router, template engine, DI, validation, sessions, CLI.

v0.0.5(1mo ago)35538GPL-3.0-or-laterPHPPHP &gt;=8.5

Since May 28Pushed 3w ago26 watchersCompare

[ Source](https://github.com/MADEVAL/ATOM)[ Packagist](https://packagist.org/packages/globus-studio/atom)[ Docs](https://github.com/MADEVAL/ATOM)[ RSS](/packages/globus-studio-atom/feed)WikiDiscussions main Synced 1w ago

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

Atom
====

[](#atom)

[![PHP 8.5](https://camo.githubusercontent.com/ce84700419354e4105b07e15b706bf2f95a0ddeda59ba8042aabdf3491749a95/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e352d626c7565)](https://www.php.net/releases/8.5/en.php)![Tests](https://camo.githubusercontent.com/f3d59aabff905e2e09d3e1b80623b50094f8ab04aa7f9ed4e8e3b9b802d360df/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d677265656e)![Coverage](https://camo.githubusercontent.com/5c0015a04dcecdcebd3dbff1a74495d92483afc5bd0b6329d2549502cba333a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d38352e32392532352d79656c6c6f77677265656e)[![License: GPL-3.0](https://camo.githubusercontent.com/52646ee067526034b3c09558c48d180154f7bae52557a1ecfc965c89f2bdf88e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d332e302d6f72616e6765)](LICENSE)![Router](https://camo.githubusercontent.com/afd82411302319b2cb0541855a19a40b944c75ca6f277ec73e42f6a477ad9770/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f7069632d726f757465722d726564)![PCRE](https://camo.githubusercontent.com/055bea350da688c904a089ae36821a8a11a89bf2a91c940a03b44580b48f679a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f7069632d706372652d707572706c65)![Microframework](https://camo.githubusercontent.com/6efe5008fb8551424cb58cba9cc3c40f8d7f160e85d714a721830273a13fba32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f7069632d6d6963726f6672616d65776f726b2d79656c6c6f77)![Templates](https://camo.githubusercontent.com/aa04d4e19b1b2a5394dc7824da7005ca161f83f3279e06e779433023b19418c3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f7069632d74656d706c617465732d7465616c)![Validation](https://camo.githubusercontent.com/30dd911490ae808d34f55caa03a5b84c8c0d962dd074d6340660d9dfc0abdf39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f746f7069632d76616c69646174696f6e2d6379616e)

PHP 8.5 micro‑framework. Single PCRE router, template engine, DI, validation, sessions, database, CLI.

---

Why Atom
--------

[](#why-atom)

**Zero dependencies.** Just PHP 8.5. No HTTP factory, no annotations - pure PHP with PCRE at its core.

**Minimal codebase.** Read the entire framework in 20 minutes. Current suite: 728 tests, 1108 assertions, 85.29% line coverage, clean PHPStan level 5.

**One regex dispatches all routes.** 10 000 routes = one `preg_match` via `(?|...(*:N))` branch-reset + MARK. JIT-compiled, O(1) per request.

**Batteries included.** Validation on 18 attribute rules, Twig-like templates, sessions with CSRF rotation, CORS, file uploads, database, logger with rotation, CLI with help - things you'd otherwise compose from 5 packages.

**Built for APIs and full-stack.** JSON body parsing, Bearer token extraction, method spoofing, cache headers - everything you need for a REST API. Templates with inheritance, blocks, filters - everything you need for server-rendered pages.

**Use it for:** REST APIs, microservices, admin panels, static-site backends, MVPs, prototyping, educational projects, anything where you want full control without a framework fighting you.

---

Scope of Application
--------------------

[](#scope-of-application)

ScenarioFitNotes**REST API**ExcellentJSON body auto-parse, Bearer token, method spoofing, CORS, status codes**Microservice**ExcellentZero deps, single-file deploy, 850 lines of code**Admin panel**GoodTemplates with inheritance, CSRF, sessions, validation**Static-site backend**GoodTemplate engine, routing, config from .env**MVP / Prototype**ExcellentFull stack in one file, rapid iteration**Hobby project**ExcellentEasy to learn, zero config needed**High-traffic API**GoodO(1) routing, JIT-compiled PCRE, route cache**Real-time / WebSocket**GoodBuilt-in WebSocket server, rooms, broadcast**Enterprise CMS**Not suitableNo migrations, no admin generator**E-commerce**PossibleWould need custom cart/payment logic, DB only**SPA backend**GoodJSON API + CORS + JWT via Bearer token**Server-rendered pages**GoodTemplate inheritance, blocks, filters, auto-escape---

Install
-------

[](#install)

```
composer require globus-studio/atom
```

Quick start
-----------

[](#quick-start)

```
use Atom\{Application, Config};

$app = new Application(Config::fromEnv(__DIR__ . '/.env'));

$app->router->get('/', 'HomeController@index');
$app->router->group('/api', ['Auth'], fn($r) => {
    $r->get('/users/{id}', 'UserController@show', 'user.show');
    $r->post('/users', 'UserController@create');
});

$app->run();
```

Features
--------

[](#features)

ComponentDescription**Router**Single `preg_match` dispatch via `(?|...(*:N))`. Groups, URL gen, attributes, signature-aware cache.**Templates**Twig-like → compiled PHP classes. Extends, blocks, filters, raw blocks.**Validation**18 attribute rules: `#[Required]` `#[Email]` `#[Regex]` `#[Min]` `#[Max]` `#[Integer]` `#[Between]` `#[In]` `#[Url]` `#[Nullable]` `#[Confirmed]` `#[Ip]` `#[Domain]` `#[Mac]` `#[FloatVal]` `#[Boolean]` `#[Uuid]` `#[Each]`**Database**Minimal PDO wrapper: `all()`, `one()`, `single()`, `run()`, prepared statements.**Middleware**Closure**Session**`get/set/flash/regenerate`, CSRF token generation &amp; rotation.**CLI**`bin/atom list/help/routes/cache/ws:serve`, custom commands with descriptions, `NO\_COLOR` support.**Request**Property hooks, JSON body, Bearer token, `_method` spoofing, file uploads.**Response**`html/json/text/redirect/noContent`, cookies, cache headers, header injection shield.**Container**DI: `bind`, `singleton`, `instance`, `has`, recursive autowire.**Config**`fromEnv('.env')` with `APP\_ENV` profiles (`.env.production`), `APP\_DEBUG`, `APP\_CACHE\_DIR`, `APP\_VIEWS\_DIR`, `APP\_TIMEZONE`, `APP\_LOG\_LEVEL`, `APP\_LOG\_MAX\_SIZE`, `APP\_NAME`, `APP\_ROUTE\_CACHE`, `APP\_VIEW\_CACHE`, `APP\_CACHE\_DRIVER`, `WS\_HOST`, `WS\_PORT`.**Logger**File-based, 7 levels, min-level filter, context, atomic writes, rotation, clear.**HTTP Test Client**`HttpClient` — fluent API: `$client->get('/users')->assertOk()->assertJson(['id' => 1])`.**Rate Limiter**`#[RateLimit(max: 60, window: 60)]` middleware — per-IP request limiting.**Health Check**`$router->health('/health', fn() => ['db' => true])` — Kubernetes-ready.**Paginator**`Paginator::from($req)->paginate($items, $total)` — page/perPage/total/pages.**Encryption**`Encrypt::encrypt()` / `Encrypt::decrypt()` — AES-256-GCM with key derivation.**Cache**`$app-&gt;cache()`, PSR-16-like: `set/get/has/delete/flush`, TTL, `remember`, atomic counters, ArrayDriver, FileDriver.**ORM**Model, guarded Query builder, Relations (`hasMany`, `belongsTo`, `hasOne`), eager loading, Pagination.**WebSocket**`$app-&gt;ws()`, room management, broadcast, RFC 6455 handshake/frame validation, CLI `ws:serve`.Example
-------

[](#example)

```
// .env
APP_DEBUG=true
DB_DSN=sqlite:/var/app/db.sqlite
APP_TIMEZONE=Europe/Moscow
```

```
// public/index.php
use Atom\{Application, Config};
use Atom\Database\Database;
use Atom\Http\Response;
use Atom\Support\Logger;
use Atom\Validation\{Required, Email};

$config = Config::fromEnv(__DIR__ . '/../.env');
$app = new Application($config);

$app->container->singleton(Database::class,
    fn() => new Database($config->get('DB_DSN')));
$app->container->singleton(Logger::class,
    fn() => new Logger($config->get('APP_LOG_FILE'), $config->logLevel));

final class CreateUser {
    #[Required] public string $name = '';
    #[Required] #[Email] public string $email = '';
}

$app->router->post('/users', 'UserController@create');
$app->router->get('/users/{id}', 'UserController@show', 'user.show');

class UserController {
    public function __construct(private Database $db, private Logger $log) {}

    public function create(Request $req): Response {
        try {
            $dto = $req->validate(CreateUser::class);
        } catch (ValidationException $e) {
            return Response::json($e->errors, StatusCode::BAD_REQUEST);
        }
        $this->db->run('INSERT INTO users (name,email) VALUES (?,?)', [$dto->name, $dto->email]);
        $this->log->info('user created', ['name' => $dto->name]);
        return Response::json(['id' => $this->db->lastId()], StatusCode::CREATED);
    }

    public function show(string $id): Response {
        $user = $this->db->one('SELECT * FROM users WHERE id = ?', [$id]);
        return $user ? Response::json($user) : Response::json(['error' => 'Not found'], StatusCode::NOT_FOUND);
    }
}

$app->run();
```

Project structure
-----------------

[](#project-structure)

```
src/Atom/
├── Config.php              # debug, cacheDir, viewsDir, timezone, logFile, logLevel, logMaxSize, appName, fromEnv(), get()
├── Constants.php           # framework constants
├── Application.php         # entry point, boot, run
├── Console/Console.php     # CLI: list, help, routes, cache, custom commands, NO_COLOR
├── Cache/
│   ├── Cache.php             # PSR-16-like: set, get, has, delete, flush, remember
│   ├── Driver.php            # driver interface
│   ├── ArrayDriver.php       # in-memory TTL driver
│   └── FileDriver.php        # file-based TTL driver
├── Container/Container.php # DI: bind, singleton, instance, has, autowire
├── Database/Database.php   # PDO wrapper: all, one, single, run
├── Orm/
│   ├── Model.php              # base model class
│   ├── Query.php              # query builder
│   ├── Relation.php           # base relation
│   ├── HasMany.php            # hasMany relation
│   ├── BelongsTo.php          # belongsTo relation
│   ├── HasOne.php             # hasOne relation
│   ├── Column.php             # column attribute
│   ├── PrimaryKey.php         # primary key attribute
│   └── Table.php              # table name attribute
├── Http/
│   ├── Request.php         # hooks, JSON body, Bearer, _method, file(), validate()
│   ├── Response.php        # html, json, text, redirect, cookies, cache, send()
│   ├── Session.php         # get/set, flash, regenerate, csrfToken, validateCsrf
│   ├── StatusCode.php      # enum 200..503
│   └── UploadedFile.php    # typed $_FILES: ok, size, ext, root-bound move()
├── Middleware/
│   ├── MiddlewareInterface.php
│   ├── Cors.php            # preflight + CORS headers, origin reflection
│   ├── Csrf.php            # CSRF token validation with rotation
│   ├── Pipeline.php        # onion: Closure | object | string
│   └── RateLimit.php       # per-IP request rate limiting
├── Routing/
│   ├── Route.php           # #[Route] attribute
│   ├── CompiledRoute.php   # internal representation
│   ├── RouteCompiler.php   # single PCRE regex
│   └── Router.php          # dispatch, groups, url(), cache, routes(), health()
├── WebSocket/
│   ├── Server.php             # RFC 6455 event loop, rooms, broadcast
│   └── Connection.php         # connection wrapper, send, sendJson, ping, close
├── Support/
│   ├── Logger.php          # file logger: 7 levels, rotate, clear, maxSize
│   ├── Regex.php           # PCRE wrapper
│   ├── Paginator.php       # page/perPage/total/pages from request
│   └── Encrypt.php         # AES-256-GCM encryption
├── Test/
│   └── HttpClient.php      # fluent API test client
├── Validation/
│   └── Validator.php       # 18 attribute rules + ValidationException
└── View/
    ├── Compiler.php         # Twig-like → PHP, nested braces, for-loop shadow restore
    ├── Engine.php           # render, filters, globals
    └── Template.php         # base template class

```

Running tests
-------------

[](#running-tests)

```
composer test
composer test-coverage
composer stan
```

Docs &amp; resources
--------------------

[](#docs--resources)

- [Full documentation](docs/index.html) — sidebar, all components, code examples
- [Skill set](.opencode/skills/atom/) — AI‑assistant knowledge: routing, HTTP, templates, validation, ORM, DI, CLI, middleware
- [License](LICENSE) — GPL-3.0-or-later

License
-------

[](#license)

GPL-3.0-or-later. See [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance92

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity42

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

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/285d32ac89643c66426e75f97a13c5eee2d8e8b809efd2d6fdde4665837b7b63?d=identicon)[Yevhen Leonidov](/maintainers/Yevhen%20Leonidov)

---

Top Contributors

[![MADEVAL](https://avatars.githubusercontent.com/u/10908537?v=4)](https://github.com/MADEVAL "MADEVAL (40 commits)")

---

Tags

high-performancemicroframeworkmicroservicepcrepdophp85routertemplatestwigvalidationphpframeworkroutertemplatePCREmicro-framework

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/globus-studio-atom/health.svg)

```
[![Health](https://phpackages.com/badges/globus-studio-atom/health.svg)](https://phpackages.com/packages/globus-studio-atom)
```

###  Alternatives

[slim/php-view

Render PHP view scripts into a PSR-7 Response object.

2759.9M101](/packages/slim-php-view)

PHPackages © 2026

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