承接 maslosoft/addendum 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

maslosoft/addendum

Composer 安装命令:

composer require maslosoft/addendum

包简介

Powerful and easy to use PHP annotations

README 文档

README

Addendum Logo Maslosoft Addendum

Powerful and easy to use PHP annotations

Latest Stable Version License Scrutinizer Code Quality Code Coverage

Quick Install

composer require maslosoft/addendum

Documentation

Full Addendum Documentation

Annotations for PHP

This project provides smart annotations support for PHP language with the aim on performance and ease of use.

Annotations are in fact a kind declarative language embedded in PHP code. It does not allow and flow control structures, loops, conditions. It allows us to describe what is required or what we expect from parf of code.

Where to use annotations

While (PHP) programming language itself is very flexible and allows us to describe complex bahaviors, there are some aspects where we want to only describe (or configure) such behaviors. And we want to keep our main code as is, while adding some additional behaviors, which might include:

  • Access control
  • Way to display data
  • Whether to store data
  • Where to store data
  • Should the data be searchable

And so on, with ever growing list of aspects and behaviors. While this could be made by implementing in our classe more and more interfaces, soon those would end up in hundreds of methods.

Another way could be some kind of extra meta-data configuration, let it be in XML, JSON or YAML files. This requires us to keep those too files in sync and also separates declarations from code. But we might need extra behaviors/aspects for many libraries - resulting in code being split into two or more files.

Embed behavior into code

So the idea is to embed those extra aspects of class into code. With annotations - special comment tags placed just above class/method/property declaration.

These annotations can be interpreted independently by different parts of program. These are extensible, so that adding more annotations does not influence existing code.

Different application parts might interpret just part of annotations while ignoring unknown ones.

In below example one part will react @Label and @Description declarations, other will perform some extra operations when will encouner @I18N annotation.

Example:

class Page implements AnnotatedInterface
{
	/**
	 * Page URL
	 * @Label('Page URL')
	 * @Description('Relative URL, it should be simple lowercase string with words separated by hyphen')
	 * @SearchBoost(3.5)
	 * @I18N
	 * @SafeValidator
	 * @UrlValidator
	 * @Decorator(Action, 'update')
	 * @see Action
	 * @var string
	 */
	public $url = '';
}

All extra metadata is contained just where class property is declared. This is it. Annotations itself are not evaluated on each request. These are used to generate metadata, which is later available by using meta containers. Having any object implementing AnnotatedInterface, metadata can be obtained by passing either object or class name.

Example of getting meta data:

echo Meta::create(Page::class)->url->label;
// Will echo "Page URL"

This metadata is cached, so there is no overhead of parsing annotations.

maslosoft/addendum 适用场景与选型建议

maslosoft/addendum 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.57k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2013 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「annotations」 「php」 「metadata」 「annotation」 「addendum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 maslosoft/addendum 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-only
  • 更新时间: 2013-12-05