PHPackages                             getphred/atlas - 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. getphred/atlas

ActiveLibrary[Framework](/categories/framework)

getphred/atlas
==============

A high-performance, modular PHP routing engine with PSR-7 support.

00PHPCI passing

Since Feb 15Pushed 3mo agoCompare

[ Source](https://github.com/getphred/atlas)[ Packagist](https://packagist.org/packages/getphred/atlas)[ RSS](/packages/getphred-atlas/feed)WikiDiscussions master Synced 1mo ago

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

Atlas Routing
=============

[](#atlas-routing)

A high-performance, modular PHP routing engine designed for professional-grade applications. It prioritizes developer experience, architectural purity, and interoperability through PSR-7 support.

[![CI](https://github.com/getphred/atlas/actions/workflows/ci.yml/badge.svg)](https://github.com/getphred/atlas/actions/workflows/ci.yml/badge.svg)[![Packagist](https://camo.githubusercontent.com/c0ae530e7c62deb71d8f4a7708cde1d67be13afabc2a2e53f7d0fc8877c640a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67657470687265642f61746c61732e737667)](https://camo.githubusercontent.com/c0ae530e7c62deb71d8f4a7708cde1d67be13afabc2a2e53f7d0fc8877c640a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67657470687265642f61746c61732e737667)[![Total Downloads](https://camo.githubusercontent.com/23f132901d5d71619cb81452ebfb6c06643f3a683b9639b4ce28bff90a5acd31/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67657470687265642f61746c61732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/getphred/atlas)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Features
--------

[](#features)

- **Fluent API**: Expressive and chainable route definitions.
- **Dynamic Matching**: Support for `{{parameters}}` and `{{optional?}}` segments.
- **Parameter Validation**: Strict validation rules (numeric, alpha, regex, etc.).
- **Route Groups**: Recursive grouping with prefix and middleware inheritance.
- **Modular Routing**: Automatic route discovery from modules.
- **Reverse Routing**: Safe URL generation with parameter validation.
- **PSR-7 Support**: Built on standard HTTP message interfaces.
- **Advanced Capabilities**: Subdomain constraints, i18n support, and redirects.
- **Developer Tooling**: Programmatic Inspector API and CLI tools.
- **Performance**: Optimized matching engine with route caching support.

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

[](#installation)

```
composer require getphred/atlas
```

Basic Usage
-----------

[](#basic-usage)

```
use Atlas\Router\Router;
use Atlas\Config\Config;
use GuzzleHttp\Psr7\ServerRequest;

// 1. Setup Configuration
$config = new Config([
    'modules_path' => __DIR__ . '/src/Modules',
]);

// 2. Initialize Router
$router = new Router($config);

// 3. Define Routes
$router->get('/users', function() {
    return 'User List';
})->name('users.index');

$router->get('/users/{{id}}', function($id) {
    return "User $id";
})->name('users.show')->valid('id', 'numeric');

// 4. Match Request
$request = ServerRequest::fromGlobals();
$route = $router->match($request);

if ($route) {
    $handler = $route->getHandler();
    // Execute handler...
} else {
    // 404 Not Found
}
```

Route Groups
------------

[](#route-groups)

```
$router->group(['prefix' => '/api', 'middleware' => ['auth']])->group(function($group) {
    $group->get('/profile', 'ProfileHandler');
    $group->get('/settings', 'SettingsHandler');
});
```

All group routes inherit whatever options you pass in (middleware, prefix, etc).

While the above syntax works and is completely viable, I find the double group method syntax a bit confusing.

So, here is another way you can do it (my personal preferred method) that is, in my opinion, cleaner, and more readable.

```
$api = $router->group(['prefix' => '/api']);

$api->get('/users', 'UserIndexHandler');
$api->post('/users', 'UserCreateHandler');
```

Performance &amp; Caching
-------------------------

[](#performance--caching)

For production environments, you can cache the route collection:

```
if ($cache->has('routes')) {
    $routes = unserialize($cache->get('routes'));
    $router->setRoutes($routes);
} else {
    // Define your routes...
    $cache->set('routes', serialize($router->getRoutes()));
}
```

CLI Tools
---------

[](#cli-tools)

Atlas comes with a CLI tool to help you debug your routes:

```
# List all routes
./atlas route:list

# Test a specific request
./atlas route:test GET /users/5
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance55

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

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

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76918287c4577d7b4a6713f0d54f3de11e0d6a86f88bb2883b5dd0a19f80d87f?d=identicon)[getphred](/maintainers/getphred)

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/getphred-atlas/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.3k86.3M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[shopware/platform

The Shopware e-commerce core

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

Full-featured e-commerce components for high performance online shops

4.5k346.9k48](/packages/aimeos-aimeos-core)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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