定制 amjadiqbal/laravel-sonner 二次开发

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

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

amjadiqbal/laravel-sonner

Composer 安装命令:

composer require amjadiqbal/laravel-sonner

包简介

The ultimate Sonner toast notification wrapper for Laravel. Beautiful, stackable, and lightweight notifications for your Blade and Livewire applications.

README 文档

README

The ultimate Sonner toast notification wrapper for Laravel. Beautiful, stackable, and lightweight notifications for your Blade and Livewire applications.

Social Banner

Packagist Version Packagist Downloads License CI: Pest PHP Laravel

SEO

  • Modern Laravel Notifications
  • Sonner Toast for Blade and Livewire
  • Lightweight, stackable, beautiful toasts

SEO Highlights

  • Instant, sleek toast UX
  • Blade-first, Livewire-friendly
  • Promise toasts, durations & positions
  • Lightweight + stackable layout

Installation

composer require amjadiqbal/laravel-sonner

Usage

Simple

toast('Profile updated!');

Advanced

toast()
    ->success('Order Shipped')
    ->description('Your order #123 is on the way.')
    ->duration(5000);

Blade Component

Add the component at the end of your layout:

<x-sonner position="bottom-right" theme="system" />

Livewire Integration

From a Livewire component:

public function save()
{
    toast()->success('Saved')->description('Your changes were saved.');
    $this->dispatch('sonner:toast', type: 'success', title: 'Saved', description: 'Your changes were saved.');
}

In your layout:

<x-sonner />
<script>
window.addEventListener('sonner:toast', function(e){
  const d = e.detail || {};
  window.Sonner[d.type || 'toast'](d.title || '', { description: d.description || '' });
});
</script>

Promise

<button onclick="
  window.Sonner.promise(fetch('/ping'), {
    loading: 'Pinging...',
    success: 'Online',
    error: 'Offline'
  })
">Ping</button>

Configuration

  • position: top-left, top-right, top-center, bottom-left, bottom-right, bottom-center
  • theme: system, light, dark
  • duration: milliseconds
  • dismissible: true/false

Testing

composer install
vendor/bin/pest

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固