andrewbreksa/slim-action-helpers 问题修复 & 功能扩展

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

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

andrewbreksa/slim-action-helpers

Composer 安装命令:

composer require andrewbreksa/slim-action-helpers

包简介

A set of classes to make Slim 3 a bit easier to work with

README 文档

README

build-status license stars Coverage Status Latest Stable Version Total Downloads

Quick and dirty helper classes for RAD slim 3 development that fully support the __invoke Slim 3 middleware and callable paradigm.

Install

composer require andrewbreksa/slim-action-helpers

Examples

Action

<?php

namespace AndrewBreksa\SlimActionHelpers\Example\Actions;

use AndrewBreksa\SlimActionHelpers\AbstractAction;

class ExampleAction extends AbstractAction
{

    public function act()
    {
        // do some magic here
        return $this->json([
            'entity' => [
                'email' => 'andrew@andrewbreksa.com',
            ]
        ], 201);
    }
}

$app->post('/emails', \AndrewBreksa\SlimActionHelpers\Example\Actions\ExampleAction::class);

Middleware

<?php

namespace AndrewBreksa\SlimActionHelpers\Example\Middleware;

use AndrewBreksa\SlimActionHelpers\AbstractMiddleware;
use Psr\Log\LoggerInterface;

class RequestLoggingMiddleware extends AbstractMiddleware
{
    /**
     * Here, if a ResponseInterface is returned, the stack is ejected from, otherwise we continue on and automaically
     * call $next
     * @return mixed|void|null
     */
    public function act()
    {
        $this->getContainer()->get(LoggerInterface::class)->debug('request', [
            'method' => $this->getRequest()->getMethod(),
            'uri' => $this->getRequest()->getUri()->getPath(),
            'query' => $this->getRequest()->getQueryParams(),
            'headers' => $this->getRequest()->getHeaders()
        ]);
    }

}

$app->add(\AndrewBreksa\SlimActionHelpers\Example\Middleware\RequestLoggingMiddleware::class);

Docs

Eventually I may add very detailed docs, until then read the very simple source. It's literally 4 files.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固