定制 miniframe/core 二次开发

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

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

miniframe/core

最新稳定版本:v1.3.0

Composer 安装命令:

composer require miniframe/core

包简介

Core package of the Miniframe PHP Framework

关键字:

README 文档

README

This is the core package of the Miniframe PHP Framework. For more information, see the Main project at https://bitbucket.org/miniframe/miniframe-php-framework.

build code coverage

Core classes explained

This framework contains a few core classes. These classes are used in this core:

ClassDescription
AbstractControllerAll Controllers should extend this. It contains the Request and Config object.
AbstractMiddlewareAll Middlewares should extend this. It contains the Request and Config object.
BootstrapThe kickstarter of this framework.
ConfigParses the configuration files and provides an interface to request it's contents.
RegistryRegistry that can be used to store and later retrieve objects.
RequestParses the web request and provides an interface to read the request.
ResponsePopulate (or extend) this object in a Controller to return something to the client.

Middlewares included in the Core bundle

In the main project, you'll see a middleware directive in the configuration. Multiple middlewares can be loaded, and are loaded in the sequence in which they are configured.

These middlewares are included in this Miniframe Core bundle and can be used to quickly set up a basic application, or as example for building your own middleware classes:

Class nameDescription
UrlToMvcRouterURL To MVC Router; documentation at src/Middleware/UrlToMvcRouter.md
BasicAuthenticationBasic HTTP Authentication; documentation at src/Middleware/BasicAuthentication.md
SessionPHP Sessions; documentation at src/Middleware/Session.md
AccessListDeny / Allow clients based by their IP; documentation at src/Middleware/AccessList.md
ForwardedForParsing X-Forwarded-* headers when proxied; documentation at src/Middleware/ForwardedFor.md

A full list of middlewares can be found at https://miniframe.dev/middlewares

Pre-defined response types included in the Core bundle

Class nameTypeDescription
ResponseSuccessMain Response object, extended by all others.
JsonResponseSuccessReturns the data formatted as JSON.
PhpResponseSuccessUses PHP templates to create a proper response.
StreamResponseSuccessA basic 200 OK response for large files.
RedirectResponseSuccessA basic 30? Redirect page.
UnauthorizedResponseErrorA basic 401 Unauthorized page.
ForbiddenResponseErrorA basic 403 Forbidden page.
NotFoundResponseErrorA basic 404 Not Found page.
InternalServerErrorResponseErrorA basic 500 Internal Server Error page.

A Response object can be returned in a Controller method or being thrown. Throwing responses can especially be useful for error pages.

Tip for Windows Developers

In the bin folder, a few batch files exist, to make development easier.

If you install Docker Desktop for Windows, you can use bin\composer.bat, bin\phpcs.bat, bin\phpunit.bat, bin\phpstan.bat and bin\security-checker.bat as shortcuts for Composer, CodeSniffer, PHPUnit, PHPStan and the Security Checker, without the need of installing PHP and other dependencies on your machine.

The same Docker container and tools are used in Bitbucket Pipelines to automatically test this project.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: CC-BY-SA-4.0
  • 更新时间: 2020-11-20