承接 raid/caller 相关项目开发

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

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

raid/caller

Composer 安装命令:

composer require raid/caller

包简介

Raid Caller Package

README 文档

README

License Laravel

A modular, testable, and maintainable package for encapsulating outbound HTTP calls in Laravel. Raid Caller enforces a clean separation of concerns for HTTP requests, making your codebase more robust and easier to extend.

Features

  • Separation of concerns: Caller (intent), Service (execution), Receiver (parsing), DTO (domain model)
  • Immutable DTOs: Safe, readonly data transfer objects
  • Extensible: Easy to add new endpoints and customize behavior
  • Testable: Works seamlessly with Laravel HTTP fakes

Installation

composer require raid/caller
  • Compatible with Laravel 9+
  • The service provider Raid\\Caller\\Providers\\CallerServiceProvider is auto-discovered. If not, register it manually.
  • To publish the config (if available):
php artisan vendor:publish --tag=caller

Quick Start

Here's a minimal example for making a GET request:

readonly class GetUsersCaller extends \Raid\Caller\Callers\GetCaller {
    public function getUrl(): string { return 'https://api.example.com/users'; }
    public function getReceiver(): string { return GetUsersReceiver::class; }
}

readonly class GetUsersReceiver extends \Raid\Caller\Receivers\ResponseReceiver {
    public function __construct(protected int $status, protected array $users) {}
    public static function fromResponse(\Illuminate\Http\Client\Response $r): static {
        return new static(status: $r->status(), users: array_map(fn(array $u) => UserDto::fromArray($u), $r->json()));
    }
    public function toSuccessResponse(): array { return ['message' => 'Users fetched', 'data' => array_map(fn(UserDto $u) => $u->toArray(), $this->users)]; }
    public function toErrorResponse(): array { return ['message' => 'Failed to fetch users']; }
}

Concepts

  • Callers: Define HTTP method, URL, options, and receiver. (Docs)
  • Receivers: Parse responses and shape output. (Docs)
  • DTOs: Immutable data models. (Docs)
  • Service: Orchestrates execution and extension points. (Docs)
  • Traits & Provider: Utilities and configuration. (Docs, Docs)

See the Overview for a high-level map.

Lifecycle

See Lifecycle for a summary and sequence diagram.

Advanced Usage

  • Customize options, headers, and caching in Callers
  • Extend Receivers for custom response handling
  • Add new DTOs for your domain models

Testing

Use Laravel HTTP fakes to test Callers and Receivers in isolation. See Testing.

Observability & Conventions

Contributing

Contributions are welcome! Please open issues or submit pull requests.

License

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

Roadmap

See Roadmap for planned features and improvements.

Changelog

See CHANGELOG.md for release history.

raid/caller 适用场景与选型建议

raid/caller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-05