peridot-php/peridot-scope
Composer 安装命令:
composer require peridot-php/peridot-scope
包简介
Scopes for function binding and mixins
README 文档
README
Peridot Scope.
Scopes allow safe binding of state for closures and offers a mechanism for mixing state and behavior in via child scopes.
Extracted from the Peridot testing framework.
##Usage
We recommend installing this package via composer:
$ composer require peridot-php/peridot-scope:~1.0
###Creating a Scope
$scope = new Scope(); $scope->name = "Brian"; $fnWithName = function() { print $this->name; }; $fnWithName = $scope->peridotBindTo($fnWithName); $fnWithName(); //prints "Brian"
###Using the ScopeTrait
If an existing class can benefit from a Scope, you can use the ScopeTrait
class Test { use ScopeTrait; protected $definition; public function __construct(callable $definition) { $this->definition = $definition; } /** * Return the definition bound to a scope */ public function getDefinition() { $scope = $this->getScope(); return $scope->peridotBindTo($this->definition); } }
##Mixins
You can mix behavior in via child scopes.
peridot-php/peridot-scope 适用场景与选型建议
peridot-php/peridot-scope 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 230.52k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2014 年 11 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 peridot-php/peridot-scope 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 peridot-php/peridot-scope 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 230.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 26
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-14