PHPackages                             anvilm/slim-rr-boilerplate - 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. anvilm/slim-rr-boilerplate

ActiveProject[Framework](/categories/framework)

anvilm/slim-rr-boilerplate
==========================

Slim 4, RoadRunner boilerplate

v1.2.0(5mo ago)08MITPHP

Since Oct 24Pushed 5mo agoCompare

[ Source](https://github.com/AnvilM/slim-rr-boilerplate)[ Packagist](https://packagist.org/packages/anvilm/slim-rr-boilerplate)[ RSS](/packages/anvilm-slim-rr-boilerplate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (12)Versions (6)Used By (0)

Slim · RoadRunner Boilerplate
=============================

[](#slim--roadrunner-boilerplate)

PHP Boilerplate Powered by **Slim Framework** and **RoadRunner**

[![php-version-shield](https://camo.githubusercontent.com/37f439f3686f879d1062a58b409139dbbd84106105cb9c205c72608ba12abf4f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342d626c75653f6c6f676f3d706870266c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/AnvilM/slim-rr-boilerplate/)[![phpstan-shield](https://camo.githubusercontent.com/dc0a590188d27da1dd14b8e7e10bad38f38b8f822ee3a0d5a38b7c238e8dd33a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c2532306d61782d626c75653f6c6f676f3d706870266c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/AnvilM/slim-rr-boilerplate/)[![](https://camo.githubusercontent.com/5ebff1e7b08bc594889a5c74066076f23d73bcb6359173ce2bfa4def67b343c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f616e76696c6d2f736c696d2d72722d626f696c6572706c6174653f7374796c653d666c61742d73717561726526736f72743d73656d766572266c6f676f3d676974687562266c6162656c436f6c6f723d626c61636b)](https://github.com/anvilm/slim-rr-boilerplate/releases)

[![status-shield](https://camo.githubusercontent.com/f90603b7cb64db4e06b624d3c3454b6fb37eabcff2bf56ab5a906613b8975220/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d6163746976652d627269676874677265656e3f6c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/AnvilM/slim-rr-boilerplate/)[![last-commit-shield](https://camo.githubusercontent.com/ffce56071da7af3c2d07c892c1a80401562dac683a53608c6715c110110d4287/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f616e76696c6d2f736c696d2d72722d626f696c6572706c6174653f6c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/AnvilM/slim-rr-boilerplate/commits)[![](https://camo.githubusercontent.com/af9490014e78a07f157a31b6851821f9fa21757cdf765f3d29813b88f0cdaeeb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f616e76696c6d2f736c696d2d72722d626f696c6572706c6174653f6c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/anvilm/slim-rr-boilerplate/releases)[![github-license-shield](https://camo.githubusercontent.com/0f2ed2b4507642f572cd989a1386f3dd6fc83c7f5b73d45f57b399709e12e46c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616e76696c6d2f736c696d2d72722d626f696c6572706c6174653f636f6c6f723d7768697465266c6162656c436f6c6f723d626c61636b267374796c653d666c61742d737175617265)](https://github.com/anvilm/slim-rr-boilerplate/blob/master/LICENSE)

Project Overview
----------------

[](#project-overview)

This template is designed for the development of web applications utilizing the [Slim Framework](https://www.slimframework.com/) and the high-performance [RoadRunner](https://roadrunner.dev/)server. The project incorporates tools for building scalable PHP applications, including a dependency injection container, logging system, Object-Relational Mapping (ORM), database migrations, and a Command Line Interface (CLI).

Core Components
---------------

[](#core-components)

- **Container**: [PHP-DI](https://php-di.org/)
- **HTTP**: [nyholm/psr7](https://github.com/Nyholm/psr7)
- **Logger**: [Monolog](https://seldaek.github.io/monolog/)
- **ORM**: [CycleORM](https://cycle-orm.dev/)
- **Migrations**: [Cycle Migrations](https://cycle-orm.dev/docs/database-migrations/)
- **CLI**: [Symfony Console](https://symfony.com/doc/current/components/console.html)
- **Testing**: [Pest](https://pestphp.com/)
- **Static Analysis**: [PHPStan](https://phpstan.org/)

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

#### Via Composer

[](#via-composer)

Create a new project using Composer:

```
composer create-project anvilm/slim-rr-boilerplate my-project
```

#### Via GitHub

[](#via-github)

Clone the repository and install dependencies:

```
git clone https://github.com/anvilm/slim-rr-boilerplate.git my-project
cd my-project
composer install
```

### Directory Structure

[](#directory-structure)

```
.
├── app/                          # Core application logic and infrastructure
│   ├── Bootstrappers/            # Classes for initializing application components
│   ├── Commands/                 # Custom CLI commands
│   ├── Config/                   # Configuration files
│   ├── Endpoints/                # Definitions of HTTP endpoints
│   ├── Providers/                # Dependency injection container providers
│   │   ├── ApplicationProviders/ # Providers for application functionality
│   │   └── Providers/            # Custom providers
│   └── Kernel.php                # Application entry point and bootstrap management
├── bin/                          # CLI entry point
│   └── console.php               # Entry point for Symfony Console
├── database/                     # Migrations and SQLite database files
├── logs/                         # Application logs
├── src/                          # Source code for custom logic
├── tests/                        # Pest tests
└── index.php                     # Entry point for RoadRunner

```

### Directory Organization

[](#directory-organization)

The boilerplate is structured to separate infrastructural logic from user-defined code:

- **Directory `app/`**: Contains the core infrastructure of the application, including [configurations](#configuration), [providers](#providers), [endpoints](#endpoints), and [bootstrappers](#bootstrappers). This directory is intended for foundational application setup and operation.
- **Directory `src/`**: Designated for user-defined source code, where developers can implement the primary business logic of the application.

### Configuration

[](#configuration)

Application configurations are organized in the `app/Config/` directory and provide type-safe access to settings via classes with static methods. For further details, refer to the [Configuration](#configuration-1) section.

#### Environment Variables

[](#environment-variables)

Environment variables are managed using the [oscarotero/env](https://github.com/oscarotero/env) library. These variables are read directly from the system, not from a `.env` file, and are intended for use within configuration classes.

Predefined environment variables:

- **APP\_ENV**: Defines the application environment (e.g., `production`, `development`), affecting logging levels.
- **APP\_DEBUG**: Enables or disables debug mode, influencing the display of detailed error information in Slim.

#### Application Configuration

[](#application-configuration)

The `ApplicationConfig` class provides the following parameters:

- **baseDir**: The root directory of the project.
- **appEnv**: The application environment, determined by the `APP_ENV` variable. Available environments are listed in the `ApplicationEnvironmentEnum` enumeration. To add a new environment, update this enumeration and the `ApplicationConfig` class.
- **appDebug**: Debug mode, determined by the `APP_DEBUG` variable. Enables detailed error messages.

#### Database Configuration

[](#database-configuration)

The `DatabaseConfig` class defines settings for CycleORM. By default, it is configured for SQLite, but other database management systems (e.g., MySQL, PostgreSQL) are supported with appropriate configuration.

#### Logging Configuration

[](#logging-configuration)

The `LoggerConfig` class configures logging parameters using Monolog. It includes the path to log files (in the `logs/`directory) and the logging level, which depends on the `appEnv` value.

#### Migration Configuration

[](#migration-configuration)

Database migration settings are defined for Cycle Migrations. Migrations are stored in the `database/migrations/`directory and managed via [CLI commands](#commands).

Architectural Concepts
----------------------

[](#architectural-concepts)

### Configuration

[](#configuration-1)

Configurations are stored in the `app/Config/` directory. Each configuration is implemented as a class with static methods, ensuring type-safe access to settings.

Example:

```
namespace Application\Config\ApplicationConfig;

use function Env\env;

final readonly class ApplicationConfig
{
    public static function baseDir(): string
    {
        return dirname(__DIR__, 3);
    }
}
```

### Endpoints

[](#endpoints)

HTTP endpoints are defined in the `app/Endpoints/` directory. Routing is handled using the standard Slim Framework mechanism. Each endpoint class must implement the `EndpointInterface` and be registered in the [EndpointBootstrapper](#bootstrappers).

Example of creating an endpoint:

```
namespace App\Endpoints;

final readonly class ApiEndpoints implements EndpointInterface
{
    public static function register(App $app): void
    {
        $app->get('/', function (RequestInterface $request, ResponseInterface $response) {
            $response->getBody()->write('Example response');
            return $response;
        });
    }
}
```

Example of registration in [EndpointBootstrapper](#bootstrappers):

```
private static array $endpoints = [
    \App\Endpoints\ApiEndpoints::class,
];
```

### Providers

[](#providers)

Service providers, located in the `app/Providers/` directory, are responsible for registering dependencies in the PHP-DI container, making them accessible to the application. Providers are categorized as follows:

- `ApplicationProviders/`: Providers essential for application functionality.
- `Providers/`: Custom providers for specific logic.

Each provider must implement the `ProviderInterface` and be registered in the [ProvidersBootstrapper](#bootstrappers).

Example of creating a provider:

```
namespace App\Providers;

final readonly class DBALProvider implements ProviderInterface
{
    public static function register(): array
    {
        return [DatabaseManager::class => new DatabaseManager(
            new CycleDatabaseConfig(
                DatabaseConfig::config()
            )
        )];
    }
}
```

Example of registration in [ProvidersBootstrapper](#bootstrappers):

```
private static array $appProviders = [
    \App\Providers\LoggerProvider::class,
    \App\Providers\DBALProvider::class,
];

private static array $providers = [
    // Custom providers
];
```

### Bootstrappers

[](#bootstrappers)

Bootstrapper classes in the `app/Bootstrappers/` directory initialize key application components. The primary bootstrappers are:

- `ApplicationBootstrapper`: Initializes the Slim application.
- `ContainerBootstrapper`: Configures the PHP-DI container.
- `ProvidersBootstrapper`: Registers [providers](#providers).
- `EndpointBootstrapper`: Registers [endpoints](#endpoints).
- `CommandsBootstrapper`: Registers [CLI commands](#commands).

The `Kernel.php` file manages the initialization process.

### Commands

[](#commands)

CLI commands are defined in the `app/Commands/` directory. Each command must be registered in the [CommandsBootstrapper](#bootstrappers).

The Symfony Console library is used for CLI commands.

Example of registration in [CommandsBootstrapper](#bootstrappers):

```
private static array $commands = [
    \App\Commands\MigrationGenerateCommand::class,
    \App\Commands\MigrationUpCommand::class,
];
```

Available commands:

- `migration:generate`: Generates a migration template in the `database/migrations/` directory.
- `migration:up`: Executes pending migrations.

Running commands:

```
php bin/console {commandName}
```

License
-------

[](#license)

The project is distributed under the MIT License. For details, refer to the [LICENSE](LICENSE) file.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance71

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~11 days

Total

4

Last Release

165d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6be63d2e00c01cda03e8e0a314d1714133bc0839da7adb72ef75afa8e7972af?d=identicon)[AnvilM](/maintainers/AnvilM)

---

Top Contributors

[![AnvilM](https://avatars.githubusercontent.com/u/94012493?v=4)](https://github.com/AnvilM "AnvilM (51 commits)")

---

Tags

boilerplatephppsrroadrunner

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anvilm-slim-rr-boilerplate/health.svg)

```
[![Health](https://phpackages.com/badges/anvilm-slim-rr-boilerplate/health.svg)](https://phpackages.com/packages/anvilm-slim-rr-boilerplate)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

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

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[contao/core-bundle

Contao Open Source CMS

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

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[odan/slim4-skeleton

A Slim 4 skeleton

4588.5k](/packages/odan-slim4-skeleton)

PHPackages © 2026

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