tthe / bagatelle
Bagatelle is a PHP boilerplate bundle for simple websites and APIs.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/tthe/bagatelle
Requires
- php: ^8.4
- monolog/monolog: ^3.9
- nyholm/psr7: ^1.8
- php-di/php-di: ^7.1
- symfony/config: ^8.0
- symfony/console: ^8.0
- symfony/event-dispatcher: ^8.0
- symfony/http-foundation: ^8.0
- symfony/http-kernel: ^8.0
- symfony/monolog-bridge: ^8.0
- symfony/psr-http-message-bridge: ^8.0
- symfony/routing: ^8.0
- twig/twig: ^3.21
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.93
This package is not auto-updated.
Last update: 2026-02-10 04:13:35 UTC
README
- A trifle; an insubstantial thing.
- (literature, music) A short piece of literature or of instrumental music, typically light or playful in character.
― bagatelle - Wiktionary, the free dictionary
(Named in contrast to Symfony)
Introduction
Bagatelle is an opinionated PHP boilerplate bundle for simple websites and APIs. It bundles and pre-configures common components from the PHP ecosystem, making it easy to get started while having full control of all the details.
Contents
Bagatelle centers around Symfony's HttpKernel, Routing, EventDispatcher and Console packages for building web and CLI applications.
Well known packages Monolog (PSR-3 logging), PHP-DI (PSR-11 dependency injection container), Twig (templating engine), phpdotenv (environment variables) and nyholm/psr7 (HTTP messages) are bundled and preconfigured as well.
A basic but functional implementation for adding middleware to routes and controllers along with CORS support is also included.
Additionally, a Docker image based on FrankenPHP is ready for development and production use-cases.
Get Started
Create project
Create a new application based on Bagatelle (replace "my-project" with your name of choice):
composer create-project tthe/bagatelle my-project
Run application
When developing you can either use PHPs built-in development server:
php -S localhost:8080 -t public
or using Docker:
docker compose up -d # or, for production config: SERVER_NAME="your-domain.com" docker compose -f compose.yaml -f compose.prod.yaml up
Both will start your Bagatelle-based application at localhost:8080.
The console application is executed using:
php bin/console.php
Documentation
- HttpKernel and Request/Response Lifecycle
- Routing (only parts related to the
#[Route]attribute are relevant) - HttpFoundation and PSR-7: HTTP message interfaces for HTTP messages
- The Dependency Injection Container
- Console Commands