merterciyescagan/thanos
Composer 安装命令:
composer require merterciyescagan/thanos
包简介
Thanos is a PHP-based library designed to emulate the power of the Infinity Gauntlet. It allows users to manipulate data using the six Infinity Stones: Mind, Power, Reality, Soul, Space, and Time. Each stone has unique abilities that alter the given data.
README 文档
README
Thanos is a PHP-based library designed to emulate the power of the Infinity Gauntlet. It allows users to manipulate data using the six Infinity Stones: Mind, Power, Reality, Soul, Space, and Time. Each stone has unique abilities that alter the given data.
Features
-
Mind Stone: Reverses text.
-
Power Stone: Replaces random letters in text with '*'.
-
Reality Stone: Shuffles characters in text.
-
Soul Stone: Repeats text one time with dividers.
-
Space Stone: Adds 2 spaces between characters.
-
Time Stone: Modifies a date based on the input.
-
Infinity Gauntlet: Uses all six stones to remove half of the data.
Installation
composer require merterciyescagan/thanos
Usage
Using Individual Stones
Mind Stone
$mindStone = new Stone(new Mind()); $mindStone = $mindStone->set("Hello World"); echo $mindStone->use()->getResult(); // Output: "dlroW olleH"; echo $mindStone->use(2)->getResult(); // Output: "Hello World" echo $mindStone->use(2)->use()->getResult(); // Output: "dlroW olleH"
Power Stone
$powerStone = new Stone(new Power()); $powerStone = $powerStone->set("Hello World"); echo $powerStone->use()->getResult(); // Output: "Hello Wo*ld" echo $powerStone->use(2)->getResult(); // Output: "Hell* Wo*ld" echo $powerStone->use(2)->use()->getResult(); //Output: "He*ll* Wo*ld"
Reality Stone
$realityStone = new Stone(new Reality()); $realityStone = $realityStone->set("Hello World"); echo $realityStone->use()->getResult(); // Output: Randomly shuffled text echo $realityStone->use(2)->getResult(); // Output: 2 times randomly shuffled text echo $realityStone->use(2)->use()->getResult(); // Output: 3 times randomly shuffled text
Soul Stone
$soulStone = new Stone(new Soul()); $soulStone = $soulStone->set("Hello World"); echo $soulStone->use()->getResult(); // Output: "Hello World | Hello World" echo $soulStone->use(2)->getResult(); // Output "Hello World | Hello World | Hello World | Hello World" echo $soulStone->use(2)->use()->getResult(); // Output "Hello World | Hello World | Hello World | Hello World | Hello World | Hello World | Hello World | Hello World"
Space Stone
$spaceStone = new Stone(new Space()); $spaceStone = $spaceStone->set("Hello World"); echo $spaceStone->use()->getResult(); // Output: "H e l l o W o r l d" echo $spaceStone->use(2)->getResult(); // Output: ""H e l l o W o r l d"" echo $spaceStone->use(2)->use()->getResult(); // Output: "H e l l o W o r l d"
Time Stone
$timeStone = new Stone(new Time()); $timeStone = $timeStone->set(+1); echo $timeStone->use()->getResult(); // Output: +1 day based on today echo $timeStone->use(2)->getResult(); // Output: +2 day based on today echo $timeStone->use(2)->use()->getResult(); // Output: +3 day based on today
Using the Gauntlet
$mindStone = new Stone(new Mind()); $powerStone = new Stone(new Power()); $realityStone = new Stone(new Reality()); $soulStone = new Stone(new Soul()); $spaceStone = new Stone(new Space()); $timeStone = new Stone(new Time()); $gauntlet = new Gauntlet(); $gauntlet->setGauntlet( new InfinityGauntlet(), [$mindStone, $powerStone, $realityStone, $soulStone, $spaceStone, $timeStone] ); $result = $gauntlet->snap(['Iron Man', 'Thor', 'Hulk', 'Black Widow']); print_r($result); // Random half removed
Requirements
- PHP 8.0+
- Composer
Contributing
Feel free to fork and submit pull requests. Bug reports and feature requests are welcome!
License
MIT
merterciyescagan/thanos 适用场景与选型建议
merterciyescagan/thanos 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 merterciyescagan/thanos 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 merterciyescagan/thanos 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-23