定制 lucinda/framework-engine 二次开发

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

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

lucinda/framework-engine

Composer 安装命令:

composer require lucinda/framework-engine

包简介

API integration engine for Lucinda Framework 3.0

README 文档

README

This API stores internal components of Lucinda Framework 3.0 open for update but not open for change by developers. Most of the classes inside are dedicated at APIs binding, so only the following are of any interest to developers:

API is fully PSR-4 compliant, only requiring PHP7.1+ interpreter and SimpleXML extension. It has 100% Unit Test coverage, using UnitTest API instead of PHPUnit for greater flexibility.

AbstractCacheable

This abstract class is a \Lucinda\Headers\Cacheable that binds to STDOUT MVC API in order to implement recipe for a class able to generate an ETag/LastModified header value for response to any cacheable requested resource.

That value will be used in cache-driven communication between your project and client's browser and thus make it possible for your site to answer only with 304 Not Modified header instead of full response in case latter hasn't changed.

Class defines following prototype methods developers must implement when extending:

Method Arguments Returns Description
setTime void void Sets ETag representation of response to requested resource into $etag field
setEtag void void Sets LastModified representation of response to requested resource into $last_modified_time field

By virtue of binding to STDOUT MVC API, classes implementing above will have access to following protected fields:

Field Type Description
$request \Lucinda\STDOUT\Request Request received from client.
$response \Lucinda\MVC\Response Response to send back to caller.

AbstractLoginThrottler

This abstract class is a \Lucinda\WebSecurity\Authentication\Form\LoginThrottler that penalizes each failed login by pow(2, failedAttempts-1) seconds in order to fight against dictionary attacks.

Throughout the period of penalty, login will fail automatically without checking database. The more consecutive failed attempts, the greater the penalty. Once login passes, all penalties are unset.

Class defines following prototype methods developers must implement when extending:

Method Arguments Returns Description
persist void void Tracks login attempts to a storage medium (sql or nosql database)

Classes implementing above will have access to following protected fields:

Field Type Description
$attempts integer How many attempts were made from current IP for same username.
$penaltyExpiration integer|NULL UNIX time at which penalty will expire, if any

AbstractReporter

This abstract class is a \Lucinda\STDERR\Reporter that binds to Logging API in order to report errors to logs based on their severity level, identified by value of attribute error_type of exception tag @ stderr.xml that matches \Exception handled:

Value Effect
none Exception is not an error so it will not be reported.
client Exception is an error caused by client (eg: a 404), so it will not be logged except if developers decide otherwise.
server Exception is an error caused by database server, so it will be logged with emergency priority.
syntax Exception is a code bug made by developers, so it will be logged with alert priority.
logical Exception is a conceptual bug discovered at runtime, so it will be logged with critical priority.
Exception is a generic error, so it will be logged with error priority.

Class defines following prototype method developers must implement when extending:

Method Arguments Returns Description
getLogger void \Lucinda\Logging\Logger Generates and returns a logger instance from matching reporter tag @ stderr.xml

Json

This class is an OOP wrapper over PHP's native functions, encapsulating json generation and execution, throwing \Lucinda\Framework\Json\Exception in case process fails. Class defines following methods, all relevant to developers:

Method Arguments Returns Description
encode mixed string Encodes a primitive/array/object to json format.
decode string array Decodes a json into array.

RestController

This abstract class is a \Lucinda\MVC\Controller to be extended if your project is a RESTful web service API. Classes extending it must implement a method for each HTTP method respective route supports:

Method Arguments Returns Description
GET void void Logic to execute when respective route is accessed via GET method.
POST void void Logic to execute when respective route is accessed via POST method.
PUT void void Logic to execute when respective route is accessed via PUT method.
DELETE void void Logic to execute when respective route is accessed via DELETE method.
HEAD void void Logic to execute when respective route is accessed via HEAD method.
CONNECT void void Logic to execute when respective route is accessed via CONNECT method.
OPTIONS void void Logic to execute when respective route is accessed via OPTIONS method.
TRACE void void Logic to execute when respective route is accessed via TRACE method.

If a route is accessed using a method not covered in its matching controller, a \Lucinda\STDOUT\MethodNotAllowedException is thrown!

Unlike other frameworks, Lucinda considers controller "actions" to be an anti-pattern, a recipe for bloated illogical controllers. Only in this particular case are "actions" making a logical sense: a controller that behaves differently depending on HTTP method it's called with.

lucinda/framework-engine 适用场景与选型建议

lucinda/framework-engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.54k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 lucinda/framework-engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lucinda/framework-engine 我们能提供哪些服务?
定制开发 / 二次开发

基于 lucinda/framework-engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-07