marshmallow/simple-value-metric
Composer 安装命令:
composer require marshmallow/simple-value-metric
包简介
A Laravel Nova card.
README 文档
README
Nova Simple Value Metric
A Laravel Nova card that renders a simple value metric with a title, footer, optional help text and an optional action button.
Installation
Install the package via Composer:
composer require marshmallow/simple-value-metric
The card registers itself through Laravel package auto-discovery (Marshmallow\SimpleValueMetric\CardServiceProvider), so no further setup is required.
Usage
Add the card to the cards() method of any Nova resource or dashboard:
use Marshmallow\SimpleValueMetric\SimpleValueMetric; protected function cards() { return [ (new SimpleValueMetric) ->title('Scored quotations') ->calculate(function ($metric) { return $metric->formattedValue(72) ->footer('99% of the quotations are orders!'); }) ->help('72 of a total of 73 quotations are now orders :)'), ]; }
The value is set inside the calculate() callback so it can be computed at render time. The callback receives the card instance, on which you call the fluent methods below.
Available methods
| Method | Description |
|---|---|
title(string $title) |
The label shown above the value. |
calculate(callable $callback) |
Callback (receiving the card) used to compute the metric when it renders. |
formattedValue(mixed $value) |
The value displayed on the card. |
footer(string $footer) |
Text shown below the value. |
suffix(string $suffix) |
A suffix appended to the value (e.g. a unit or percentage sign). |
button(string $link, string $text, string $class = 'btn btn-default btn-primary', string $target = '_blank') |
Render an action button on the card. |
showButtonWhen(Closure $closure) |
Show the button only when the closure returns true. |
help(string $helpText) |
Help text shown in a tooltip on the card. |
helpWidth(int $width) |
Width of the help tooltip in pixels (defaults to 250). |
The card width can be set with Nova's standard $width property (1/3, 1/2, or full); it defaults to 1/3.
Adding a button
use Marshmallow\SimpleValueMetric\SimpleValueMetric; (new SimpleValueMetric) ->title('Open quotations') ->calculate(function ($metric) { return $metric->formattedValue(12) ->footer('Quotations awaiting review') ->button('/nova/resources/quotations', 'View all'); });
Security
If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see the License File for more information.
marshmallow/simple-value-metric 适用场景与选型建议
marshmallow/simple-value-metric 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.49k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marshmallow/simple-value-metric 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marshmallow/simple-value-metric 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marshmallow/simple-value-metric 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 11.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-23
