定制 binary-cats/shoutout 二次开发

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

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

binary-cats/shoutout

Composer 安装命令:

composer require binary-cats/shoutout

包简介

An inspirational title for your toasts

README 文档

README

Shoutout

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Inspirational titles for your toasts.

Ever got stuck writing another title for your success toast? Ever got bored with "Success!" message? Shoutout solves this for you with random configurable messages

Installation

composer require binary-cats/shoutout

You can publish the config file with:

php artisan vendor:publish --tag=shoutout-config

This will create config/shoutout.php where you can customize the titles for each notification type. This is the contents of the published config file:

return [

    /*
    |--------------------------------------------------------------------------
    | Default Message Type
    |--------------------------------------------------------------------------
    |
    | The default message type to use when calling Shoutout::random() without
    | specifying a type. Supported: "info", "success", "warning", "danger", "error"
    |
    */

    'default' => 'info',

    /*
    |--------------------------------------------------------------------------
    | Messages
    |--------------------------------------------------------------------------
    |
    | These titles will be randomly selected for toast notifications based
    | on their type. Feel free to customize these to match your app's tone.
    |
    */

    'messages' => [
        'info' => [
            'Just so you know...',
            'A quick heads-up',
            'No alarms, just info',
            'Keeping you in the loop',
            'For your consideration',
            'Minor detail, major impact',
            'Logged and loaded',
            'Nothing urgent',
            'All part of the plan',
            'Thought you might like to know',
            'Friendly little update',
        ],
        'success' => [
            'Achievement unlocked!',
            'Flawless execution',
            'Great success!',
            'Huzzah!',
            'Like a boss',
            'Nice!',
            'Smooth as butter!',
            'That\'s how it\'s done!',
            'Very nice!',
            'Victory dance initiated',
            'We made it!',
            'Well done!',
        ],
        'warning' => [
            'Watch out',
            'Careful now',
            'Hmm...',
            'Warning',
            'Hold up',
            'Attention',
            'Heads up',
        ],
        'danger' => [
            'Oh well',
            'Not good',
        ],
        'error' => [
            'Oops',
            'Oh no',
            'Yikes',
            'Error',
            'So sad',
            'Uh oh!',
        ],
    ],
];

Usage

Shoutout comes in two flavors. You can use a Shoutout facade or a shoutout() helper method:

use BinaryCats\Shoutout\Facades\Shoutout;

// Get a random title using the default type (configured in config)
$title = Shoutout::random();   // Uses 'info' set by default

// Get random titles by specific type
$successTitle = Shoutout::success();  // "Achievement unlocked!", "Nice!", etc.
$infoTitle = Shoutout::info();        // "Just so you know...", "A quick heads-up", etc.
$warningTitle = Shoutout::warning();  // "Watch out", "Careful now", etc.
$dangerTitle = Shoutout::danger();    // "Oh well", "Not good"
$errorTitle = Shoutout::error();      // "Oops", "Oh no", etc.

Example with Toast Notifications

// In a Controller
public function store(Request $request): RedirectResponse
{
    // ... save logic

    return redirect()
        ->route('posts.index')
        ->with('toast', [
            'type' => 'success',
            'title' => Shoutout::success(),
            'message' => 'Post created successfully!'
        ]);
}

or with Livewire Flux:

    Flux::toast(
        heading: Shoutout::success(),
        text: 'Your changes have been saved.',
        variant: 'success',
    );

.. you get the idea.

Testing

Shoutout provides a test fake:

use BinaryCats\Shoutout\Facades\Shoutout;

public function test_it_shows_success_toast(): void
{
    Shoutout::fake()
        ->expect('success')
        ->andReturn('Test Success');

    $response = $this->post('/posts', ['title' => 'Test']);

    $response->assertSessionHas('toast.title', 'Test Success');
}

You can chain fake expectations:

Shoutout::fake()
    ->expect('success')->andReturn('Yay!')
    ->expect('danger')->andReturn('Oh no!')
    ->expect('error')->andReturn('Failed!');

If no expectation is set for a method, the fake will return a random value from config (same as the real implementation).

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Support us

Binary Cats is a webdesign agency based in Illinois, US.

License

The MIT License (MIT). Please see License File for more information.

binary-cats/shoutout 适用场景与选型建议

binary-cats/shoutout 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 binary-cats/shoutout 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-24