symbiont/support-forward-call 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

symbiont/support-forward-call

最新稳定版本:v1.0.4

Composer 安装命令:

composer require symbiont/support-forward-call

包简介

Forward Call Support

README 文档

README

Minimal forward call trait using magic methods __call and __callStatic.

This package is work in progress!

Requirements

  • php 8.2

Installation

composer require symbiont/support-forward-call

Usage

Simple example of using ForwardsCall.


use Symbiont\Support\ForwardCall\Contracts\ForwardsCalls;
use Symbiont\Support\ForwardCall\ForwardsCall;

use Some\Container;
use Some\Dispatcher;
use Some\SomethingElse;

/**
 * @method methods
 * @method to
 * @method ..  
 */
class Awesome implements ForwardsCalls {

    use Forwardscall;

    protected object $container;
    protected object $dispatcher;
 
    public function __construct() {
        $this->container = new Container;
        $this->dispatcher = new Dispatcher;
        $this->something_else = new SomethingElse;
    }
 
    protected function forwardContainer(): array {
        return [
            'methods', 'to', 'be', 
            'forwarded' // static
        ];
    }
 
    protected function forwardDispatcher(): array {
        return [
            'method' => 'that',
            'can' => 'beBend',
            'mixed', 'with', 'others'
        ]
    }
    
    // converts to property `something_else`
    protected function forwardSomethingElse(): array {
        return [
           // .. methods
        ]       
    }
}

$object = new Awesome;
$object->methods();
// call $this->container->methods()
$object->can();
// calls $this->dispatcher->beBend()
$object::forwarded(); 
// calls $this->container::forwarded()

Documentation

This documentation only documents the technical usage of this package with little to no text.

Tests

composer test

License

MIT license

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-19