PHPackages                             samushi/domion - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. samushi/domion

ActiveLibrary[Framework](/categories/framework)

samushi/domion
==============

Domion - Professional Architecture for Laravel with Automated Frontend &amp; Auth Integration

1.6.4(4mo ago)066MITPHPPHP ^8.2

Since Dec 28Pushed 4mo agoCompare

[ Source](https://github.com/samushi/Domion)[ Packagist](https://packagist.org/packages/samushi/domion)[ RSS](/packages/samushi-domion/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (62)Used By (0)

🏗️ Domion – The Ultimate DDD Starter Kit for Laravel
====================================================

[](#️-domion--the-ultimate-ddd-starter-kit-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6416b277ea1ebe9423ae8fa892393c94c7e5791068883c1a468dfed0293dfb61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616d757368692f646f6d696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/samushi/domion)[![Total Downloads](https://camo.githubusercontent.com/a85e801b56da627675c812f48cc362ad9e72d9c88c000ca514399b3f62eb45c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616d757368692f646f6d696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/samushi/domion)[![License](https://camo.githubusercontent.com/15452c88444f85cf33a476eb53ba9db6b2a01fdedc622d57e21a941359367cb5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616d757368692f646f6d696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/samushi/domion)

Welcome to **Domion**! 👋

Simplify your enterprise Laravel development with a robust **Domain-Driven Design (DDD)** architecture. **Domion** is not just a structure package; it is a **Complete Starter Kit** that gives you everything you need to launch a professional, scalable application in minutes.

Whether you're building a **RESTful API**, a **React SPA**, or a **Vue.js application**, Domion has you covered with pre-configured authentication, settings modules, and enterprise-grade patterns.

---

🚀 Why Choose Domion?
--------------------

[](#-why-choose-domion)

FeatureDescription**DDD Architecture**Pre-configured structure with Actions, DTOs, Repositories, and Domain separation.**Three Starter Modes**Choose between **API**, **React (Inertia)**, or **Vue (Inertia)** during setup.**Built-in Security**Two-Factor Authentication (2FA) via Laravel Fortify with complete UI.**API Response Builder**Standardized JSON responses using `marcin-orlowski/laravel-api-response-builder`.**Query Filters**Powerful filtering system using `samushi/query-filter` integrated in Repositories.**Settings Module**Profile, Password, Appearance, and Account Deletion – all pre-built.**Multi-tenancy Ready**Full support for Stancl/Tenancy for SaaS applications.---

📦 Installation Guide
--------------------

[](#-installation-guide)

Follow these simple steps to start your journey with Domion.

### Step 1: Create a Laravel Project

[](#step-1-create-a-laravel-project)

Start with a fresh Laravel installation.

```
laravel new my-app
cd my-app
```

### Step 2: Install Domion

[](#step-2-install-domion)

Install the package via Composer.

```
composer require samushi/domion
```

### Step 3: Setup Your Architecture 🪄

[](#step-3-setup-your-architecture-)

This is where the magic happens. The interactive setup command will:

- Ask you to choose between **API**, **React**, or **Vue** mode
- Configure your project structure
- Install all necessary dependencies
- Scaffold core domains (Auth, Dashboard, Settings)
- Set up 2FA via Fortify (for React/Vue modes)

```
php artisan domion:setup
```

### Step 4: Launch Your Application

[](#step-4-launch-your-application)

**For API Mode:**

```
php artisan migrate
php artisan serve
```

**For React/Vue Mode:**

```
npm install
npm run dev
php artisan migrate
php artisan serve
```

Open your browser and explore your new application!

---

🎯 Starter Kit Modes
-------------------

[](#-starter-kit-modes)

Domion supports three distinct modes, each optimized for different use cases.

### 1. 🔌 API Mode (Headless)

[](#1--api-mode-headless)

Perfect for building RESTful APIs, mobile backends, or microservices.

**Features:**

- No frontend UI – pure JSON API endpoints
- Standardized API responses via `laravel-api-response-builder`
- Token-based authentication (Laravel Sanctum)
- Clean controller structure extending `ApiControllers`

**API Response Example:**

```
// In your Controller
return $this->success($data, 'Data retrieved successfully');

// Response:
{
    "success": true,
    "code": 200,
    "message": "Data retrieved successfully",
    "data": { ... }
}
```

**Error Response:**

```
return $this->error('Validation failed', 422);

// Response:
{
    "success": false,
    "code": 422,
    "message": "Validation failed"
}
```

---

### 2. ⚛️ React Mode (Inertia.js)

[](#2-️-react-mode-inertiajs)

Modern single-page application experience with React and TypeScript.

**Features:**

- Full React + TypeScript + Inertia.js setup
- Pre-built pages: Login, Register, Dashboard, Settings
- Shadcn-inspired UI components
- Dark/Light mode support
- Sidebar navigation layout
- Two-Factor Authentication UI

**Included Pages:**

- `/` – Landing Page
- `/login` – Authentication
- `/register` – User Registration
- `/dashboard` – Protected Dashboard
- `/settings/profile` – Profile Management
- `/settings/password` – Password Update
- `/settings/appearance` – Theme Selection
- `/settings/two-factor` – 2FA Management

---

### 3. 💚 Vue Mode (Inertia.js)

[](#3--vue-mode-inertiajs)

Elegant single-page application with Vue 3 and TypeScript.

**Features:**

- Full Vue 3 + TypeScript + Inertia.js setup
- Same pre-built pages as React mode
- Component-based architecture
- Dark/Light mode support
- Responsive layouts

---

🏗️ Architecture Overview
------------------------

[](#️-architecture-overview)

Domion organizes your code into **Domains**. Each domain is self-contained, handling its own logic, database interactions, and frontend views (if applicable).

### Directory Structure

[](#directory-structure)

```
app/
├── Domain/
│   ├── Auth/                    # Authentication Domain
│   │   ├── Actions/             # LoginAction, RegisterAction, etc.
│   │   ├── Controllers/         # AuthController
│   │   ├── Requests/            # LoginRequest, RegisterRequest
│   │   └── web.php              # Domain routes
│   │
│   ├── Dashboard/               # Dashboard Domain
│   │   ├── Controllers/         # DashboardController
│   │   └── web.php              # Dashboard routes
│   │
│   ├── Settings/                # Settings Domain
│   │   ├── Actions/             # UpdateUserProfileAction, DeleteUserAction
│   │   ├── Dto/                 # UpdateProfileDto, UpdatePasswordDto
│   │   ├── Requests/            # ProfileUpdateRequest, PasswordUpdateRequest
│   │   ├── Controllers/         # SettingsController
│   │   └── web.php              # Settings routes
│   │
│   ├── User/                    # User Domain
│   │   ├── Models/              # User.php
│   │   └── Repository/          # UserRepository
│   │
│   └── [YourDomain]/            # Your Custom Business Logic
│       ├── Actions/
│       ├── Dto/
│       ├── Models/
│       ├── Repository/
│       ├── Requests/
│       └── Controllers/
│
├── Support/                     # Shared Infrastructure
│   ├── Controllers/             # Base Controllers (ApiControllers, InertiaControllers)
│   ├── Traits/                  # HttpResponseTrait, InertiaResponseTrait
│   ├── Middleware/              # HandleInertiaRequests
│   └── Frontend/                # Layouts, Components (React/Vue)
│       ├── Layouts/
│       ├── components/
│       └── Pages/

```

---

🧱 Core Concepts
---------------

[](#-core-concepts)

### 1. Actions (Business Logic)

[](#1-actions-business-logic)

Actions are the heart of your business logic. Each action does **one thing** and does it well.

**Creating an Action:**

```
php artisan domion:make:action CreateOrder
```

**Action Structure:**

```
