psg/sr4 问题修复 & 功能扩展

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

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

psg/sr4

Composer 安装命令:

composer require psg/sr4

包简介

Flexible Layered DI App Standard

README 文档

README

PHP is a language of flexibilty. Why shouldn't our apps be based on a flexible standard - make the framework account for flexibility, and allow the users to have flexibility in the code they write.

By this standard:

  • wares shall have a process method
  • wares (middle, front, back, ...) shall expect injected dependencies into both __construct and process
  • For HTTP Apps:
    • framework shall allow injection for all Sr1 factories and Pgs\Sr1\ResponseInterface, Pgs\Sr1\ServerRequestInterface, Pgs\Sr4\ExitResponseInterface
    • output of wares can include, not limited to, Pgs\Sr1\ResponseInterface, Pgs\Sr1\ServerRequestInterface, Pgs\Sr4\ExitResponseInterface
      • framework shall integrated these into the response and request
  • framework shall implement
    • ->get() for retrieving a named service
    • ->set() for adding a named service
    • ->call() for calling something with dependency injection. This can include constructing a class, by providing just the class name.
    • ->data() for retrieving and setting data
      • ->data(key): retrieve
      • ->data(key, value): set

Because interfaces do not allow defining only the presense of a method, the fulfillment of the standard is left up to the programmer (a method defined with no arguments in an interface then requires implementers to make all arguments optional).

Flow

See SR-2

SR 2 Variances

  • the parameters and returns are not specified in the interface. This is to allow the framework to accept a variety of returns, including PSR 7 an SR-1 returns, and then integrate those returns
  • Coreware now has an interface. It can still be injected as a closure
  • Corewars array. It is now possible to have multiple corewares.
    • if you want to remove all coreware:
$App->remove(Coreware::class)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固