Download the PHP package yntech/domain-forge without Composer

On this page you can find all versions of the php package yntech/domain-forge. 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 domain-forge

Domain Forge

Latest Version Total Downloads License

Domain Forge is a powerful Laravel package that streamlines the creation of domain modules following Hexagonal Architecture (Ports & Adapters) and Domain-Driven Design (DDD) principles. Generate complete, production-ready domain structures with a single command.

🌟 Features

πŸ“‹ Requirements

πŸš€ Installation

Install the package via Composer:

βš™οΈ Configuration

1. Configure Base Structure

Run the installation command to set up the base structure:

2. Update Composer Autoload

Add the following to your composer.json in the autoload.psr-4 section:

3. Refresh Autoload

πŸ“š Usage

Basic Domain Generation

Create a simple domain module:

This generates:

Domain with Properties

Generate a domain with value objects:

Generated Value Objects:

Entity Structure:

🎯 Property Types

Supported Types

Type Example Value Object Method
string name:string fromString(string)
int age:int fromInt(int)
float price:float fromFloat(float)
bool active:bool fromBool(bool)
?string description:?string fromNullableString(?string)
?int quantity:?int fromNullableInt(?int)
?float discount:?float fromNullableFloat(?float)
?bool verified:?bool fromNullableBool(?bool)

Nullable Types

Add ? prefix for nullable properties:

Generated Value Object:

πŸ”’ Enum Support

Creating Enums

Use the enum[value1|value2|value3] syntax:

Generated Enum Structure

File: src/Contexts/Order/Domain/Enums/OrderStatus.php

Using Enums in Your Code

Enum Examples

πŸ†” Auto-Generated IDs

String IDs (UUID)

When you define an id:string property, Domain Forge automatically generates UUID methods:

Generated UserId Value Object:

Entity create() method excludes ID:

Integer IDs (Auto-increment)

For database auto-increment IDs:

Generated ProductId Value Object:

πŸ” Special Property Types

Password Fields

Properties containing "password" get special hashing methods:

Generated UserPassword Value Object:

Usage:

Timestamp Fields

Properties ending with _at are treated as timestamps:

These use fromString() or fromNullableString() methods automatically in fromPrimitives().

πŸŽ›οΈ Command Flags

--props

Define entity properties with their types:

--skip-model

Skip Laravel Eloquent model and migration generation:

Use case: When you don't need database persistence or already have the model.

🎨 Customization with Stubs

Publishing Stubs

Publish stub templates to your project:

This creates:

Customizing Stubs

Edit any stub file to change the generated code structure. For example, add timestamps to all entities:

Edit: stubs/domain-forge/entity.stub

Available Stub Variables

Each stub supports different replacement variables:

entity.stub:

value-object.stub:

enum.stub:

Force Overwrite Stubs

πŸ—ΊοΈ Generated Mappers

When generating a domain with properties (and without --skip-model), Domain Forge creates a mapper:

File: src/Contexts/User/Infrastructure/Persistence/Mappers/UserMapper.php

Usage in Repository:

πŸ“– Real-World Examples

E-Commerce Product

User Management System

Blog Post

Support Ticket System

Invoice System

πŸ›‘οΈ Error Handling & Rollback

Domain Forge includes automatic rollback on errors:

Output:

Permission Validation

Before generating, Domain Forge checks:

Example error:

πŸ“Š Generation Summary

After successful generation, you'll see a detailed summary:

πŸ”§ Advanced Usage

Foreign Keys

Use *_id properties for foreign keys (they won't auto-generate):

Combining Features

This creates:

πŸ“ Best Practices

1. Property Naming

2. Enum Values

3. Nullable Usage

Use nullable only when truly optional:

4. ID Strategy

Choose consistent ID strategy per project:

🎯 Domain-Driven Design Tips

Aggregates

Create separate domains for aggregates:

Value Objects

Rich domain models emerge from proper value objects:

Domain Events

Add events to your domain entities (manual step):

πŸ› Troubleshooting

Error: "No write permissions"

Error: "Class not found"

Enum ValueError

Property validation errors

Ensure property names follow rules:

🚧 Roadmap

v3.1 (Planned)

v3.2 (Planned)

Future

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

Running Tests

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ™ Credits

Created and maintained by Allmacht.

πŸ“ž Support

⭐ Show Your Support

If you find this package helpful, please consider giving it a ⭐ on GitHub!


Made with ❀️ by Allmacht


All versions of domain-forge with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.2|^13.0
illuminate/console Version ^12.2|^13.0
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 yntech/domain-forge contains the following files

Loading the files please wait ...