承接 dkpankaj1/toastr 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dkpankaj1/toastr

最新稳定版本:1.2.0

Composer 安装命令:

composer require dkpankaj1/toastr

包简介

A lightweight and customizable Toastr notification service for Laravel.

README 文档

README

A simple Laravel package to display Toastr notifications using Blade components.

Installation

1. Install via Composer

Run the following command to install the package:

composer require dkpankaj1/toastr

2. Publish Assets & Views

Run the following command to publish the necessary assets and views:

php artisan vendor:publish --tag=toastr

This will copy the views and assets to your Laravel application:

  • Views: resources/views/components/toaster.blade.php
  • Assets(css & js): public/assets/toastr/

3. Register Service Provider (if not auto-discovered)

If your Laravel version does not support auto-discovery, add the service provider manually in bootstrap/providers.php:

'providers' => [
    Dkpankaj1\Toastr\ToastrServiceProvider::class,
];

4. Include Assets in Your Layout

Add the following line to your main layout file (e.g., resources/views/layouts/app.blade.php):

<link rel="stylesheet" href="{{asset('assets/toastr/toastr.min.css')}}" />
<script src="{{asset('assets/toastr/toastr.min.js')}}"></script>

Usage

1. Include Toastr in Your Blade Template

Add the following line to your main layout file (e.g., resources/views/layouts/app.blade.php):

<x-toastr />

2. Display Notifications in Controller

You can use Laravel's session to flash messages that will be shown via Toastr:

use Dkpankaj1\Toastr\Services\ToasterService;

ToasterService::success('success message');
ToasterService::error('error message');
ToasterService::warning('warning message');
ToasterService::info('info message');

3. Customizing Toastr Options

Modify resources/views/components/toaster.blade.php to customize the notification settings:

Credits

Developed by Dkpankaj1.

License

This package is open-source and licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-02