承接 faran/pulsar 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

faran/pulsar

Composer 安装命令:

composer require faran/pulsar

包简介

An opinionated Laravel architecture for building modular, domain-driven applications at scale

README 文档

README

An opinionated Laravel architecture for building modular, domain-driven applications at scale.

Pulsar is an opinionated architecture tool. It provides a strict and explicit approach to organizing Laravel applications using clean architecture, domain-driven design, and service-oriented patterns. This architecture works well for medium-to-large scale applications, multi-tenant SaaS platforms, and teams that benefit from enforced boundaries between business logic and delivery mechanisms. If you prefer Laravel's default structure or flexible, ad-hoc patterns, Pulsar may not be the right fit.

This README is intentionally concise. It defines the architectural contract, not a tutorial.

Table of Contents

Installation

composer require faran/pulsar --dev

Generate your first service:

pulsar make:service Admin

Architecture Overview

Pulsar organizes your Laravel application into two complementary layers.

  • Service Layer — delivery and orchestration
  • Domain Layer — business logic

Service Layer

Purpose: HTTP delivery and application orchestration, scoped by consumer audience (Admin, Client, Internal).

app/Services/{Service}/
├── Providers/
│   ├── {Service}ServiceProvider.php
│   └── RouteServiceProvider.php
├── Routes/
│   └── api.php
└── Modules/{Module}/
    ├── Controllers/
    ├── Requests/
    ├── UseCases/
    └── Operations/

A Service is:

  • A delivery boundary (Admin API, Client API)
  • Scoped to a consumer audience
  • A logical separation inside a single Laravel application

A Service is NOT:

  • A microservice
  • A bounded context
  • A deployment unit
  • An isolated database or schema

Services may share the same database, Domain layer, and deployment.

Domain Layer

Purpose: Business logic independent of delivery concerns (HTTP, controllers).

app/Domain/{Domain}/
├── Models/
├── Actions/
├── DTOs/
├── Policies/
├── Events/
├── Enums/
├── Exceptions/
└── Queries/

The Domain layer is Laravel-first:

  • Uses Eloquent models
  • Uses Laravel events
  • Uses Laravel authorization
  • Has zero dependency on Services

It is independent of HTTP, not independent of Laravel.

Architecture Rules

Shared Vocabulary

Term Meaning
Service Delivery boundary for a consumer audience
Module Feature slice within a Service
Domain Business capability (Order, Catalog)
UseCase Application workflow
Operation Reusable workflow fragment for UseCases
Action Atomic domain operation

Service Layer Call Graph

Controllers call UseCases only. Only UseCases call Operations. Multiple UseCases may call the same Operation.

Operations

Operations are reusable workflow fragments shared across UseCases. They may include sequencing and conditional branching decisions. They must never own transactions or emit domain events.

Cross-Domain Logic

Cross-domain coordination belongs in UseCases, never in Actions.

Transactions

UseCases own all transaction boundaries.

Actions and Operations must never manage transactions.

Return Types

Actions and Queries may return domain models, collections, primitives, or void. They must never return HTTP or framework response objects.

Anti-Patterns

  • Fat Controllers containing business logic
  • Controllers calling Operations directly
  • Actions calling other Actions
  • Operations emitting domain events
  • Transactions inside Actions or Operations
  • UseCases calling other UseCases

If you feel tempted to do any of the above, the architecture is being violated.

Why Pulsar Exists

Pulsar optimizes for:

  • Team-scale clarity
  • Predictable code placement
  • Easier PR reviews
  • Safer refactors
  • Fewer "where does this logic go?" debates

Flexibility is traded for consistency — deliberately.

File Types

Service Layer

Type Purpose
Service Bootstrap a delivery boundary
Controller HTTP handling only
Request Validation and authorization
UseCase Workflow orchestration
Operation Reusable workflow fragment across UseCases (branching allowed; no transactions/events)

Domain Layer

Type Purpose
Model Domain entity (Eloquent)
Action Atomic business operation
DTO Data transfer
Event Domain event
Enum Domain state
Exception Business rule violation
Query Read-only domain query

Commands Reference

Service Layer

  • make:service {name}
  • make:controller {name} {module} {service} --resource
  • make:request {name} {module} {service}
  • make:use-case {name} {module} {service}
  • make:operation {name} {module} {service}

Domain Layer

  • make:model {name} {domain}
  • make:action {name} {domain}
  • make:dto {name} {domain}
  • make:policy {name} {domain}
  • make:event {name} {domain}
  • make:enum {name} {domain}
  • make:exception {name} {domain}
  • make:query {name} {domain}

Complete Example

See project documentation for a full end-to-end example covering Domain and Service layers.

Contributing

Contributions are welcome. Please follow the architecture rules and existing conventions.

License

MIT License.

Credits

Built with ❤️ by Faran Ali

Inspired by:

  • Lucid Architecture
  • Clean Architecture
  • Domain-Driven Design

faran/pulsar 适用场景与选型建议

faran/pulsar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「crud」 「laravel」 「scalable」 「ddd」 「scaffolding」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 faran/pulsar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 faran/pulsar 我们能提供哪些服务?
定制开发 / 二次开发

基于 faran/pulsar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 43
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-04