定制 wearesho-team/yii-http 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wearesho-team/yii-http

Composer 安装命令:

composer require wearesho-team/yii-http

包简介

Yii2 Web Extension for internal Wearesho Team projects usage

README 文档

README

Latest Stable Version Total Downloads Build Status codecov

Alternative work with HTTP

Contents

View

Implement your view

<?php

namespace App\Views;

use Wearesho\Yii\Http\View;

class EntityView extends View {
    /** @var string  */
    protected $foo;
    
    /** @var \SomeClass  */
    protected $dependency;
    
    public function __construct(string $foo, \SomeClass $dependency) {
        $this->foo = $foo;
        $this->dependency = $dependency;
    }
    
    protected function renderInstantiated(): array {
        return [
            'bar' => $this->foo,
        ];
    }
}

then use it

<?php

use App\Views\EntityView;

$argument = 'foo';
$output = EntityView::render($argument);

print_r($output);

/**
 * Will output: 
 * Array
  (
      [bar] => 1
  )
 */
// or if you have multiple data
$arguments = [
    '1',
    '2',
];
$output = EntityView::multiple($arguments);

/**
 * Will output
 * Array
   (
       [0] => Array
           (
               [bar] => 1
           )
   
       [1] => Array
           (
               [bar] => 2
           )
   
   )
 */

GetParamsBehavior [Example]

Fills Panel attributes from \yii\web\Request::get().

Installation

composer require wearesho-team/yii-http

Add to your DI container:

<?php
\Yii::$container->setSingleton(
    \yii\web\Response::class,
    \Wearesho\Yii\Http\Response::class
);
\Yii::$container->set(
    \yii\web\ErrorHandler::class,
    \Wearesho\Yii\Http\ErrorHandler::class
);
\Yii::$container->setSingleton(\yii\db\Connection::class);

TODO

  1. Documentation
  2. Tests

LICENSE

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固