Search by

sonsonyyy / slim-api-starter

sonsonyyy

A modern API-first starter kit for Slim Framework 4.

Package info

github.com/sonsonyyy/slim-api-starter

Type:project

pkg:composer/sonsonyyy/slim-api-starter

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

v0.1.0-alpha.1 2026-09-10 17:06 UTC

This package is auto-updated.

Last update: 2026-09-10 17:44:28 UTC


README

A modern API-first starter kit for Slim Framework 4.

Slim API Starter is an opinionated Slim Framework starter project designed for building clean, maintainable REST APIs with database support, migrations, validation, dependency injection, logging, and Pest testing ready out of the box.

Features

  • Slim Framework 4
  • API-first project structure
  • Modular layered architecture
  • PHP-DI dependency injection container
  • Environment configuration using .env
  • PostgreSQL and MySQL database support
  • Doctrine ORM via doctrine/orm
  • Request validation using symfony/validator
  • Phinx database migrations
  • Monolog logging
  • Pest testing by default
  • PHPStan static analysis
  • PHP CS Fixer code formatting
  • Example health check endpoint

Architectural Style

This starter uses a Modular Layered Architecture.

The goal is to provide a clean structure without making the application too complex for small and medium-sized APIs.

Each module may contain its own actions, services, routes, and related classes. Shared application concerns such as middleware, validation, responses, exceptions, and database configuration are placed in shared folders.

Recommended responsibility flow:

Route → Action/Controller → Service → Repository/Model → Database

Why Modular Layered Architecture?

Slim is a lightweight microframework. It gives developers flexibility, but without a good structure, applications can quickly become hard to maintain.

This starter provides a practical structure where:

  • routes define API endpoints
  • actions/controllers handle HTTP requests and responses
  • services contain business logic
  • repositories or models handle database access
  • validators handle request validation
  • middleware handles cross-cutting HTTP concerns
  • configuration stays outside business logic
  • tests are organized by behavior and unit scope

Recommended Use Cases

This starter is ideal for:

  • REST API projects
  • small to medium-sized backend services
  • learning Slim Framework
  • API prototypes

Package Type

This package is intended to be installed as a project:

composer create-project sonsonyyy/slim-api-starter my-api

License

This project is open-sourced software licensed under the MIT license.