Download the PHP package lava83/laravel-ddd without Composer

On this page you can find all versions of the php package lava83/laravel-ddd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-ddd

DDD Foundation for Laravel

[!IMPORTANT]
Currently work in progress! 🚧

A comprehensive toolkit providing foundational building blocks for implementing Domain-Driven Design (DDD) patterns in Laravel 12+ applications. This package offers battle-tested base classes, contracts, and infrastructure components to help you build scalable, maintainable domain-driven applications.

Features

Requirements

Installation

Install via Composer:

Core Concepts

Entity Hierarchy

Quick Start Guide

1. Creating an Entity

Entities are domain objects with identity that can change over time:

2. Creating an Aggregate Root

Aggregates are the main entry points for domain operations and manage domain events:

3. Implementing a Repository

Repositories provide collection-like access to aggregates:

4. Creating Entity-Model Mappers

Mappers handle the translation between domain entities and infrastructure models:

5. Registering Mappers

Create a mapper resolver to manage entity-to-mapper relationships:

Register in your service provider:

6. Working with Domain Events

Create domain events to capture important business occurrences:

Handle events using Laravel Event Subscribers:

Register the subscriber in your EventServiceProvider:

7. Creating Application Services

Application services orchestrate domain operations:

8. Creating Value Objects

Value objects represent descriptive aspects of your domain:

Simple Date Range Value Object Example

Using Built-in Value Objects

Key Features Explained

Automatic Event Dispatching

When you save an aggregate through a repository, domain events are automatically dispatched:

The Repository base class handles this through the dispatchUncommittedEvents() method, which uses Laravel's Illuminate\Events\Dispatcher.

Optimistic Locking

All entities include automatic version tracking to prevent lost updates:

UUID Primary Keys

Models automatically use UUIDs as primary keys by extending the framework's Model base class:

Transaction Support

Repositories automatically wrap save operations in transactions:

Architecture & Layering

Recommended Project Structure

Layer Responsibilities

Domain Layer (Pure PHP, no Laravel dependencies)

Application Layer (Minimal Laravel usage)

Infrastructure Layer (Full Laravel integration)

Service Provider Setup

Register Repositories

Register Application Services

Best Practices

1. Keep Domain Layer Pure

Minimize Laravel dependencies in the domain layer:

2. Use Helper Functions Sparingly

Use Laravel helpers like collect() in domain when beneficial:

3. Always Use Static Factory Methods

Create aggregates through named constructors:

4. Record Events for All State Changes

5. Use Transactions for Aggregate Saves

Always wrap saves in transactions to ensure consistency:

Planned Features

Troubleshooting

"No mapper found for entity class"

Ensure you've registered the mapper in your EntityMapperResolver:

"Concurrency Exception"

This indicates two processes tried to update the same aggregate simultaneously. Handle it gracefully:

Events Not Dispatching

Ensure:

  1. You're calling save() on the repository (not directly on the model)
  2. Your event subscribers are registered in EventServiceProvider
  3. Events extend the framework's DomainEvent base class

Contributing

This is currently a private package. For questions or suggestions, contact the maintainer.

License

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

Credits

Built with ❀️ by lava83 for building scalable Laravel applications using Domain-Driven Design principles.


All versions of laravel-ddd with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
giggsey/libphonenumber-for-php Version ^9.0
illuminate/contracts Version ^13.0
indexzer0/eloquent-filtering Version ^2.2
lava83/laravel-sqid Version ^0.2.0
spatie/laravel-data Version ^4.18
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lava83/laravel-ddd contains the following files

Loading the files please wait ...