amjadiqbal/alertify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

amjadiqbal/alertify

Composer 安装命令:

composer require amjadiqbal/alertify

包简介

A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES , AVAILABLE FOR LARAVEL PROJECTS.

README 文档

README

A beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript's popup boxes, available for Laravel projects.

Latest Stable Version Total Downloads License

Introduction

Alertify is a Laravel package that integrates the AlertifyJS library to provide beautiful, customizable alert and notification boxes for your Laravel applications. It offers a simple and elegant way to replace JavaScript's default popup boxes with more stylish and functional alternatives.

Features

  • Beautiful, responsive alert dialogs
  • Toast notifications
  • Customizable themes and styles
  • WAI-ARIA accessibility support
  • Simple integration with Laravel
  • Middleware support for automatic alerts
  • Session-based alert management

Installation

Step 1: Install the package via Composer

composer require amjadiqbal/alertify

Step 2: Register the Service Provider (Laravel 5.4 or below)

For Laravel 5.5 and above, the package will be auto-discovered. For older versions, add the service provider to your config/app.php file:

'providers' => [
    // ...
    AmjadIqbal\Alertify\Providers\AlertifyServiceProvider::class,
],

Step 3: Publish the assets

php artisan vendor:publish --provider="AmjadIqbal\Alertify\Providers\AlertifyServiceProvider"

This will publish:

  • Configuration file to config/alertify.php
  • JavaScript assets to public/alertify/
  • Views to resources/views/vendor/alertify/

Configuration

After publishing the configuration file, you can customize the default settings in config/alertify.php:

return [
    'default' => [
        'title'             => [],
        'text'              => [],
        'timer'             => env('ALERTIFY_TIMER'),
        'width'             => env('ALERTIFY_WIDTH'),
        'heightAuto'        => env('ALERTIFY_HEIGHT_AUTO'),
        'padding'           => env('ALERTIFY_PADDING'),
        'animation'         => env('ALERTIFY_ANIMATION'),
        'showConfirmButton' => env('ALERTIFY_SHOW_CONFIRM_BUTTON'),
        'showCloseButton'   => env('ALERTIFY_CLOSE_BUTTON'),
    ],

    'middleware' => [
        'title'               => '',
        'text'                => '',
        'type'                => '',
        'html'                => '',
        'toast'               => '',
        'position'            => '',
        'width'               => '',
        'showConfirmButton'   => '',
        'showCloseButton'     => '',
    ]
];

Usage

Basic Usage

// Display a simple alert
alert(['title' => 'Hello!', 'text' => 'Welcome to Alertify', 'type' => 'success']);

// Display an alert with more options
alert([
    'title' => 'Oops...', 
    'text' => 'Something went wrong!', 
    'type' => 'error',
    'timer' => 3000,
    'showCloseButton' => true
]);

Using with Controllers

public function store(Request $request)
{
    // Process the request...
    
    // Display a success message
    alert([
        'title' => 'Success!',
        'text' => 'Your data has been saved.',
        'type' => 'success'
    ]);
    
    return redirect()->back();
}

Using the Middleware

You can use the included middleware to automatically display alerts based on session data. Add the middleware to your app/Http/Kernel.php file:

protected $middlewareGroups = [
    'web' => [
        // ...
        \AmjadIqbal\Alertify\Core\Alertify::class,
    ],
];

Then, you can flash alert data to the session:

$request->session()->flash('title', 'Success!');
$request->session()->flash('text', 'Operation completed successfully.');
$request->session()->flash('type', 'success');

Including in Blade Templates

Make sure to include the Alertify scripts in your Blade templates:

@include('alertify::alert')

Available Alert Types

  • success
  • error
  • warning
  • info
  • question

Customization

You can customize the appearance and behavior of alerts by modifying the configuration or passing custom options when calling the alert() function.

Support

If you encounter any issues or have questions, please feel free to create an issue on the GitHub repository.

License

The Alertify package is open-sourced software licensed under the MIT license.

Credits

amjadiqbal/alertify 适用场景与选型建议

amjadiqbal/alertify 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 amjadiqbal/alertify 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-17