PHPackages                             pekral/arch-app-services - 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. pekral/arch-app-services

ActiveLibrary[Framework](/categories/framework)

pekral/arch-app-services
========================

Laravel package providing architectural abstractions for services, repositories and model managers

0.4(1mo ago)022.0k[2 issues](https://github.com/pekral/arch-app-services/issues)MITPHPPHP ^8.4CI passing

Since Oct 26Pushed 1mo agoCompare

[ Source](https://github.com/pekral/arch-app-services)[ Packagist](https://packagist.org/packages/pekral/arch-app-services)[ Docs](https://github.com/pekral/arch-app-services)[ RSS](/packages/pekral-arch-app-services/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (52)Versions (24)Used By (0)

[![Arch App Services Logo](logo.svg)](logo.svg)
===============================================

[](#)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2f633083aee086482482049822fef5e4983f622fc7ac5a78be24a6a49deb4dee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70656b72616c2f617263682d6170702d73657276696365732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pekral/arch-app-services)[![Total Downloads](https://camo.githubusercontent.com/198ad0043c80fbbb33f93f95efebeb3b6b9aa239ae8e48a690a824b3776b6c45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70656b72616c2f617263682d6170702d73657276696365732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pekral/arch-app-services)[![Tests](https://camo.githubusercontent.com/fccf690a6f9c6c86380da43231bcecec95e58c43c41ae7dc61eb2826e3662c2e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70656b72616c2f617263682d6170702d73657276696365732f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/pekral/arch-app-services/actions)[![Code Coverage](https://camo.githubusercontent.com/2c9f63f7b6db28cb7c901817386f021e62c85b5f2d027dc2b71c8fc222e233f1/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70656b72616c2f617263682d6170702d73657276696365733f7374796c653d666c61742d737175617265)](https://codecov.io/gh/pekral/arch-app-services)

> ⚠️ **This package is currently under active development.** The API may change in future versions. Use with caution in production environments.

**Arch App Services** - Clean architectural abstractions for building scalable Laravel applications

Features
--------

[](#features)

- **Action Pattern**: Clean, single-purpose classes for business logic
- **Action Logging**: Robust action execution logging with fallback mechanism
- **Repository Pattern**: Database query abstraction with pagination support
- **Repository Caching**: Automatic caching layer for repository methods with configurable TTL
- **Model Manager**: CRUD operations with batch processing and duplicate handling capabilities
- **Data Builder**: Pipeline-based data transformation using Laravel Pipeline
- **Data Validation**: Integrated validation using Laravel's validation system
- **Data Transfer Objects (DTO)**: Type-safe data objects with attribute-based validation
- **Service Layer**: Combines Repository and Model Manager for complete CRUD operations
- **PHPStan Rules**: Custom architecture rules enforcing best practices
- **Type Safety**: Full PHPDoc type annotations and generics support
- **Laravel 12+ Ready**: Built for modern Laravel features and conventions
- **100% Test Coverage**: Comprehensive test suite ensuring reliability

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require pekral/arch-app-services
```

The package will automatically register its service provider.

Optionally, you can publish the configuration file:

```
php artisan vendor:publish --tag="arch-config"
```

You can also publish the stub files for customization:

```
php artisan vendor:publish --tag="arch-stubs"
```

Code Generation
---------------

[](#code-generation)

The package provides Artisan commands for generating boilerplate code:

### Available Commands

[](#available-commands)

CommandDescription`make:arch-action`Create a new Action class`make:arch-service`Create a complete service stack (Service, Repository, ModelManager)`make:arch-dto`Create a new DTO class`make:arch-validation-rules`Create a new ValidationRules class### Examples

[](#examples)

```
# Create an Action class
php artisan make:arch-action User/CreateUserAction

# Create a complete service stack for User model
php artisan make:arch-service "App\Models\User"

# Create a DTO class
php artisan make:arch-dto User/CreateUserDTO

# Create a ValidationRules class
php artisan make:arch-validation-rules User/UserValidationRules
```

For detailed documentation about code generation, see [Code Generation Documentation](docs/code-generation.md).

Architecture Overview
---------------------

[](#architecture-overview)

This package provides a clean architecture with the following components:

1. **Actions**: Single-purpose classes that handle specific business operations
2. **Action Logging**: Robust logging system with configurable channels and fallback
3. **Services**: Combine Repository and Model Manager for complete CRUD operations
4. **Repositories**: Handle read operations with advanced querying capabilities and caching
5. **Model Managers**: Handle write operations (create, update, delete)
6. **Data Builder**: Transform data using pipeline pattern
7. **Data Validator**: Integrated validation using Laravel's validation system
8. **Data Transfer Objects (DTO)**: Type-safe data objects with attribute-based validation
9. **Pipes**: Reusable data transformation components

Usage Examples
--------------

[](#usage-examples)

### Creating a Repository

[](#creating-a-repository)

```
