LaravelStarter

laravel-starter-tpl — Laravel Starter Template

By wayofdev

A Laravel starter template maintained by wayofdev that replaces the default structure with DDD layering and integrates PHPUnit, Pest, PHPStan, Psalm, Deptrac, Deployer, and a Docker development environment.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-02View source

What stands out

A quick read of the recorded project description.

01

Transforms Laravel's default structure into a layered architecture close to DDD, including Domain, Bridge, Infrastructure, Support, and other layers

02

Integrates PHPUnit, Pest PHP, and Infection mutation testing, and uploads reports to the Stryker Mutator Dashboard

03

Configures two static analysis tools, PHPStan (including larastan) and Psalm, as well as Rector for automated refactoring

04

Containerizes the application via docker-compose and Makefile, relying on docker-shared-services for local SSL and DNS

05

Uses Deployer and GitHub Environments to support automated staging and production deployment

06

Provides GitHub Actions CI workflows and pre-commit hooks covering coding standards, tests, and static analysis

Template Details

This is a Laravel-based starter template positioned as an opinionated framework modification. It changes Laravel's default file structure to a layered approach close to Domain-Driven Design (DDD), aiming to separate business logic from infrastructure code and alleviate the structural conflicts of Eloquent's active record pattern in DDD scenarios. The template references Spatie's Laravel Beyond CRUD practices.

At the framework level, the template adds strict type declarations to all PHP files, marks default Laravel classes as final, adjusts configuration file comment style, and removes Sanctum, Pint, Sail, the broadcasting service provider and its routes, console routes, and Sanctum migration files; it also introduces spatie/laravel-route-attributes to define routes using PHP 8 attributes.

On the engineering side, the template configures PHPUnit and Pest PHP for unit and architecture tests, adds Infection for mutation testing and uploads reports to the Stryker Mutator Dashboard; static analysis uses PHPStan (including larastan, deprecation rules, and extension installer) and Psalm (including Laravel and PHPUnit plugins), with Rector for automated code upgrades and refactoring. Code style is handled by php-cs-fixer with the wayofdev/php-cs-fixer-config ruleset, Phive manages PHP tools, and pre-commit provides Git pre-commit hooks. CI is handled by GitHub Actions, including coding standard checks, unit tests, static analysis, and automatic PR labeling; deployment uses Deployer and supports staging and production workflows via GitHub Environments.

Architecturally, the project is divided into Domain, Bridge, Infrastructure, Support, DatabaseSeeders, DatabaseFactories, Tests, and other layers, each with clear dependency directions. Before use, specific environment requirements must be met: macOS Monterey+, Linux, or Windows with WSL2, Docker 26.0.0 or newer, and the docker-shared-services repository must be cloned, configured, and running to provide system-level DNS, routing, and TLS support through Traefik. The installation process relies on Makefile commands to generate .env, install dependencies, generate the application key, and start containers, ultimately accessible via https://laravel-starter-tpl.docker.

The template is MIT licensed and allows free use, modification, commercial use, and distribution of the code, provided the copyright notice and license notice are retained; third-party assets such as demo images, fonts, and icons, as well as external services such as domains, hosting, and databases, must be checked separately or may incur costs.

LaravelStarter

Is it right for your project?

Use Cases

  • New projects that want to organize Laravel business code with DDD layering instead of the default directory structure
  • Teams that need unit testing, mutation testing, static analysis, and code style checks from the start of a project
  • Those who want to unify the local development environment with Docker and Makefile and access the application via a local HTTPS domain
  • Projects that need to set up staging and production deployment workflows with Deployer and GitHub Environments
  • Developers who want to reference Spatie Laravel Beyond CRUD practices to design Laravel project structures

Suitable For

  • Backend developers familiar with Laravel and willing to accept DDD layering conventions
  • Teams that need an out-of-the-box quality toolchain (testing, static analysis, CI)
  • Developers using a Docker workflow and willing to first deploy docker-shared-services
  • Project maintainers who need staging/production automated deployment configuration

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Requires macOS Monterey+, Linux, or Windows with WSL2, and Docker 26.0.0 or newer

  2. 2

    The docker-shared-services repository must first be cloned, configured, and running to provide system-level DNS, routing, and TLS support

  3. 3

    Use Makefile commands to generate the .env file, with parameters such as APP_NAME, SHARED_SERVICES_NAMESPACE, and COMPOSE_PROJECT_NAME

  4. 4

    Run make or execute make hooks, make install, make key, make prepare, and make up step by step to complete the build and startup

  5. 5

    After startup, access the Laravel welcome page via https://laravel-starter-tpl.docker

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version under the MIT license in the public repository; the free scope is the code of this version and does not mean external services or third-party assets are free.

Must comply with when using

  • Allows free use, modification, commercial use, and distribution of this version's code.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the complete MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Before use, the separate docker-shared-services repository must be cloned, configured, and running to provide system-level DNS, routing, and TLS support through Traefik; otherwise, the local environment cannot properly resolve domains or enable HTTPS.
  • The installation instructions again emphasize that the docker-shared-services repository must be configured and running first to obtain system-level TLS and DNS support, which is a prerequisite external dependency for using this template.
  • Requires Docker version 26.0.0 or newer; Docker environments below this version cannot run according to the documented process.
  • Only supports macOS Monterey and above, Linux, or Windows with WSL2; other operating system environments are not within the supported scope.
  • Automated staging and production deployment depends on GitHub Actions and GitHub Environments, requiring corresponding environments and secrets to be configured on the GitHub platform, which is an external service dependency.
  • Demo images, fonts, icons, and other third-party assets must be checked under their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may incur additional charges.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

**Cloned, configured and running** [docker-shared-services](https://github.com/wayofdev/docker-shared-services) to support system-wide DNS, routing, and TLS support via Traefik.

Original README

You should configure, set up, and run the [docker-shared-services](https://github.com/wayofdev/docker-shared-services) repository to ensure system-wide TLS and DNS support.

Original README

**Docker**: Version 26.0.0 or newer.

Original README

**Operating System**: macOS Monterey+, Linux, or Windows with WSL2.

Original README

This repository utilizes GitHub Actions for continuous deployment to both staging and production servers.

Original README
https://github.com/wayofdev/laravel-starter-tpl/blob/develop/LICENSE.mdhttps://github.com/wayofdev/laravel-starter-tpl/blob/develop/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-03. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 87 / 100
Technologies
Laravel
Website type
Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-10-01
Screenshot last checked
2026-10-03

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Laravel as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Review declaration: [email protected] · 2026-10-04

Inspect the recorded source material

SHA-256: 2c3695b0c0a02ccd2cff4d78be49d10d04ae8b213833b61d433e84dcaee0fe7d

2026-10-03T19:21:33.354Z

Source file / repository
<p align="center">
    <br>
    <a href="https://wayof.dev" target="_blank">
        <picture>
            <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/wayofdev/.github/master/assets/logo.gh-dark-mode-only.png">
            <img width="400" src="https://raw.githubusercontent.com/wayofdev/.github/master/assets/logo.gh-light-mode-only.png" alt="WayOfDev Logo">
        </picture>
    </a>
    <br>
</p>

<p align="center">
    <strong>Build</strong><br>
    <a href="https://actions-badge.atrox.dev/wayofdev/laravel-starter-tpl/goto" target="_blank"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fwayofdev%2Flaravel-starter-tpl%2Fbadge&style=flat-square&label=github%20actions"/></a>
    <a href="https://github.com/wayofdev/laravel-starter-tpl/actions/workflows/deploy-staging.yml?query=workflow%3ADeploy" target="_blank"><img alt="Deploy to Staging Status" src="https://img.shields.io/github/actions/workflow/status/wayofdev/laravel-starter-tpl/deploy-staging.yml?branch=develop&style=flat-square&label=deploy%20to%20staging&logo=github"/></a>
    <a href="https://github.com/wayofdev/laravel-starter-tpl/actions/workflows/deploy-release.yml?query=workflow%3ADeploy" target="_blank"><img alt="Deploy to Production Status" src="https://img.shields.io/github/actions/workflow/status/wayofdev/laravel-starter-tpl/deploy-release.yml?style=flat-square&label=deploy%20to%20prod&logo=github"/></a>
</p>
<p align="center">
    <strong>Project</strong><br>
    <a href="https://github.com/wayofdev/laravel-starter-tpl" target="_blank"><img src="https://img.shields.io/github/v/release/wayofdev/laravel-starter-tpl?style=flat-square" alt="Latest Stable Version"></a>
    <a href="https://github.com/wayofdev/laravel-starter-tpl" target="_blank"><img alt="Commits since latest release" src="https://img.shields.io/github/commits-since/wayofdev/laravel-starter-tpl/latest?style=flat-square"></a>
    <a href="https://github.com/wayofdev/laravel-starter-tpl" target="_blank"><img alt="PHP Version Require" src="https://poser.pugx.org/wayofdev/laravel-package-tpl/require/php?style=flat-square"></a>
</p>
<p align="center">
    <strong>Quality</strong><br>
    <a href="https://app.codecov.io/gh/wayofdev/laravel-starter-tpl" target="_blank"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/wayofdev/laravel-starter-tpl?style=flat-square&logo=codecov"></a>
    <a href="https://dashboard.stryker-mutator.io/reports/github.com/wayofdev/laravel-starter-tpl/develop" target="_blank"><img alt="Mutation testing badge" src="https://img.shields.io/endpoint?style=flat-square&label=mutation%20score&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fwayofdev%2Flaravel-starter-tpl%2Fmaster"></a>
    <a href=""><img src="https://img.shields.io/badge/phpstan%20level-8%20of%209-brightgreen?style=flat-square" alt="PHP Stan Level 8 of 9"></a>
</p>
<p align="center">
    <strong>Community</strong><br>
    <a href="https://discord.gg/CE3TcCC5vr" target="_blank"><img alt="Discord" src="https://img.shields.io/discord/1228506758562058391?style=flat-square&logo=discord&labelColor=7289d9&logoColor=white&color=39456d"></a>
    <a href="https://x.com/intent/follow?screen_name=wayofdev" target="_blank"><img alt="Follow on Twitter (X)" src="https://img.shields.io/badge/-Follow-black?style=flat-square&logo=X"></a>
</p>
<br>

# Laravel Starter Template

This is an **opinionated** modified version of the Laravel framework which aims at providing a Domain-Driven Design (DDD) structure.

## 📄 About

Laravel is a popular PHP web framework that provides an easy and efficient way to build web applications. However, the default structure of Laravel, coupled with Eloquent's active record pattern, may not always fit the needs of a project that requires a Domain-Driven Design (DDD) architecture. Eloquent's active record pattern breaks DDD principles and make it difficult to separate your business logic from your infrastructure code.

This repository provides a modified file structure for Laravel that follows DDD principles and tries to adhere to best practices, such as those outlined in Spatie's Laravel Beyond CRUD. The goal is to provide a starting point for building Laravel applications using a DDD approach, while still leveraging the power and convenience of the Laravel framework.

<br>

🙏 If you find this repository useful, consider giving it a ⭐️. Thank you!

<br>

## 🚀 Features

This starter template includes several added, changed, and removed features:

### → Framework Modifications

* **Added:**
  * Strict types declaration in all PHP files
  * Application dockerization using docker-compose and Makefile — use `make help` to view available commands
  * [spatie/laravel-route-attributes](https://github.com/spatie/laravel-route-attributes) package for route definition using PHP8 style attributes

* **Changed:**
  * Marked default Laravel classes as `final`
  * Modified file structure to meet DDD principles (as close as possible)
  * Changed config folder files to use default PHP multi-line comment style

* **Removed:**
  * Dependencies like Laravel Sanctum, Laravel Pint, and Laravel Sail
  * Broadcasting service provider and its routes. It can be added back if required for the project
  * Console routes in favor of Command classes
  * Sanctum migration files

### → Development Tools

* **Added:**
  * Style checker package for custom rule-sets to php-cs-fixer — [wayofdev/php-cs-fixer-config](https://github.com/wayofdev/php-cs-fixer-config)
  * [Phive](https://github.com/phar-io/phive) support for managing PHP tools
    * [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) composer plugin for normalizing composer.json file
    * [maglnet/ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker) to check whether a specific composer package uses imported symbols that aren't part of its direct composer dependencies
  * Application dockerization using docker-compose and Makefile — use `make help` to view available commands
    * [docker-php-dev](https://github.com/wayofdev/docker-php-dev) as PHP development environment with XDebug support out of the box

### → Testing

* **Added:**
  * Configured [PHPUnit](https://phpunit.de/index.html) for unit testing.
  * Integrated [Pest PHP](https://pestphp.com) for elegant console support and architecture testing.
  * [Infection](https://github.com/infection/infection) for mutation testing to ensure quality.
  * Mutation test reports are uploaded [Stryker Mutator Dashboard](https://dashboard.stryker-mutator.io).

### → Static Analysis

* **Added:**
  * Static analysis tool — [PHPStan](https://phpstan.org) and it's extensions:
    * [phpstan/extension-installer](https://github.com/phpstan/extension-installer) — automatic installation of PHPStan extensions
    * [phpstan/phpstan-deprecation-rules](https://github.com/phpstan/phpstan-deprecation-rules) — rules for detecting usage of deprecated classes, methods, properties, constants and traits.
    * [larastan/larastan](https://github.com/larastan/larastan) for Laravel-specific static analysis.
  * [Psalm](https://github.com/vimeo/psalm) static analysis tool and it's extensions:
    * [psalm/plugin-laravel](https://github.com/psalm/psalm-plugin-laravel) — Psalm plugin for Laravel
    * [psalm/plugin-phpunit](https://github.com/psalm/psalm-plugin-phpunit) — Psalm plugin for PHPUnit
  * [PHP Rector](https://github.com/rectorphp/rector) for automated code upgrades and refactoring, maintaining modern code standards.

### → Continuous Integration

* **Added:**
  * GitHub action workflows for:
    * Continuous integration which includes coding standards checks, unit testing and static analysis
    * Automatic pull-request labeling
  * Git pre-commit hooks using [pre-commit](https://pre-commit.com) package

### → Deployments

* **Added:**
  * [Deployer](https://deployer.org) for automatic deployments to staging and production servers with support of [GitHub Environments](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment)
  * For more information see [Deployments](#-deployment-to-staging-and-production) section

<br>

## 🚩 Requirements

To use this repository, you need to meet the following requirements:

* **Operating System**: macOS Monterey+, Linux, or Windows with WSL2.
* **Docker**: Version 26.0.0 or newer. Installation guides:
  * [How To Install and Use Docker on Ubuntu 22.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04)
  * [How To Install Docker Desktop on Mac](https://docs.docker.com/desktop/install/mac-install/)
* **Cloned, configured and running** [docker-shared-services](https://github.com/wayofdev/docker-shared-services) to support system-wide DNS, routing, and TLS support via Traefik.

<br>

## 💿 Installation

> [!Note]
> You should configure, set up, and run the [docker-shared-services](https://github.com/wayofdev/docker-shared-services) repository to ensure system-wide TLS and DNS support.

### → Docker Shared Services

Check full instructions in [docker-shared-services](https://github.com/wayofdev/docker-shared-services) repository.

1. **Create shared project directory:**

   ```bash
   mkdir -p ~/projects/infra && cd ~/projects/infra
   ```

2. **Clone `docker-shared-services` repository:**

    ```bash
    git clone \
    [email protected]:wayofdev/docker-shared-services.git \
    ~/projects/infra/docker-shared-services && \
    cd ~/projects/infra/docker-shared-services
   ```

3. **Create `.env` file:**

    ```bash
    make env
    ```

4. **Install root certificate** and generate default project certs:

    ```bash
    make cert-install
    ```

5. **Run shared services:**

    ```bash
    make up
    ```

### → Laravel Starter Template

1. **Clone** repository:

   After forking or creating generating repository from template, you can clone it to your local machine. In this example we will use `laravel-starter-tpl` repository as starting point.

   ```bash
   git clone \
     [email protected]:wayofdev/laravel-starter-tpl.git \
     ~/projects/laravel-starter-tpl && \
   cd ~/projects/laravel-starter-tpl
   ```

2. **Generate** `.env` file

   Generate `.env` file from `.env.example` file using `Makefile` command:

   ```bash
   $ make env \
       APP_NAME=laravel \
       SHARED_SERVICES_NAMESPACE=ss \
       COMPOSE_PROJECT_NAME=laravel-starter-tpl
   ```

   **Change** generated `.env` file to match your needs, if needed.

   (Optional): to re-generate `.env` file, add `FORCE=true` to the end of command:

   ```bash
   $ make env \
       APP_NAME=laravel \
       SHARED_SERVICES_NAMESPACE=ss \
       COMPOSE_PROJECT_NAME=laravel-starter-tpl \
       FORCE=true
   ```

3. **Build**, install and run. This will also generate Laravel app key:

   ```bash
   $ make

   # or run commands separately
   $ make hooks
   $ make install
   $ make key
   $ make prepare
   $ make up
   ```

4. **Open** your browser and navigate to `https://laravel-starter-tpl.docker` to see Laravel welcome page.

<br>

## 🧰 Project Architecture

The project architecture of `wayofdev/laravel-starter-tpl` follows a structured approach with distinct layers:

* **Domain:** Contains core business logic and entities.
* **Bridge:** Connects the domain layer with external systems or services.
* **Infrastructure:** Handles interactions with external systems, such as databases, APIs, or file systems.
* **Support:** Provides general-purpose helper classes that assist various parts of the application.
* **DatabaseSeeders:** Handles database seeding logic.
* **DatabaseFactories:** Manages database factory definitions.
* **Tests:** Contains test cases for various layers of the application.

Each layer has defined dependencies, ensuring a clear separation of concerns and facilitating maintainability and scalability.

For more information check [deptrac.yaml](https://github.com/wayofdev/laravel-starter-tpl/blob/develop/app/deptrac.yaml) located in repository `app` folder.

### → Architecture Diagram

![Architecture Diagram](.github/assets/deptrac.svg)

<br>

## 🤖 Deployment to Staging and Production

This repository utilizes GitHub Actions for continuous deployment to both staging and production servers. Below is a description.

### → Deployment Flow

#### Deployment to Staging

1. **Push to `develop` branch**: Initiates the deployment process to the staging server. Merge PR against `develop` branch, to trigger `deploy-staging.yml`
2. **GitHub Actions**: Executes the `deploy-staging.yml` workflow.
3. **Staging Server**: Receives deployment instructions and acknowledges the deployment.

#### Deployment to Production

1. **Merge of `develop` branch into `master`**: Triggers the deployment process to the production server on push event.
2. **GitHub Actions**: Runs the `create-release.yml` workflow.
3. **Release Event**: `deploy-release.yml` waits for the event `release: released`.
4. **GitHub Actions**: Initiates the `deploy-release.yml` workflow.
5. **Production Server**: Receives deployment instructions and acknowledges the deployment.

#### Conditional Deployment Status

* **Deployment Successful**: Both staging and production servers send a success message back to GitHub Actions. Additionally, a success message is sent to the Slack server.

* **Deployment Failed**: If an error occurs, a failure message is sent back to GitHub Actions. Additionally, a failure message is sent to the Slack server.

#### Diagram

![deployments](.github/assets/deployments.png)

<br>

## 🧱 Credits and Useful Resources

Useful resources about Laravel and DDD approach:

* [Laravel Beyond CRUD](https://spatie.be/products/laravel-beyond-crud)

<br>

## 🔒 Security Policy

This project has a [security policy](.github/SECURITY.md).

<br>

## 🙌 Want to Contribute?

Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:

* 🤔 [Suggest a feature](https://github.com/wayofdev/laravel-starter-tpl/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
* 🐛 [Report an issue](https://github.com/wayofdev/laravel-starter-tpl/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
* 📖 [Improve documentation](https://github.com/wayofdev/laravel-starter-tpl/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
* 👨‍💻 Contribute to the code

You are more than welcome. Before contributing, kindly check our [contribution guidelines](.github/CONTRIBUTING.md).

[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge)](https://conventionalcommits.org)

<br>

## 🫡 Contributors

<p align="left">
<a href="https://github.com/wayofdev/laravel-starter-tpl/graphs/contributors">
<img align="left" src="https://img.shields.io/github/contributors-anon/wayofdev/laravel-starter-tpl?style=for-the-badge" alt="Contributors Badge"/>
</a>
<br>
<br>
</p>

## 🌐 Social Links

* **Twitter:** Follow our organization [@wayofdev](https://twitter.com/intent/follow?screen_name=wayofdev) and the author [@wlotyp](https://twitter.com/intent/follow?screen_name=wlotyp).
* **Discord:** Join our community on [Discord](https://discord.gg/CE3TcCC5vr).

<br>

## ⚖️ License

[![Licence](https://img.shields.io/github/license/wayofdev/laravel-starter-tpl?style=for-the-badge&color=blue)](./LICENSE.md)

<br>
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.