awesometoast/toastbox
Composer 安装命令:
composer require awesometoast/toastbox
包简介
Wrappers for JavaScript alert(), confirm(), prompt(), and other flexible dialogs using the Bootstrap 5 framework that does not require jQuery. This is a fork of Bootboxjs by Nick Payne.
README 文档
README
This is a fork of Bootbox by Nick Payne, specifically designed for Bootstrap 5.3+ while also removing the jQuery dependency.
Why This Fork Exists
This fork was created to:
- Focus specifically on Bootstrap 5.3+ compatibility
- Remove the jQuery dependency for Bootstrap 5 sites that don't rely on it
We gratefully acknowledge the excellent foundation provided by Nick Payne's original Bootbox project. He should get a raise of some kind. Or at least a free donut (or other pastry of his choice). Or both. Why not both?
Prerequisites
Toastbox requires Bootstrap 5.3 or higher. This package does not include Bootstrap -- you'll need to include that separately in your project.
Examples
Open examples/index.html in your web browser. It's got:
- Interactive Demos: Click buttons to see all features in action. So interactive!
- Complete Code Examples: Copy-paste ready code for every dialog type. Easy.
An all-seeing orb: It doesn't have that.
The examples use Bootstrap 5.3.7 from CDN and include toastbox.css for optimal styling. All examples demonstrate real-world usage patterns and are self-contained for easy testing.
Installation
CDN
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <script src="path/to/toastbox.js"></script>
NPM
npm install toastbox
Composer
composer require awesometoast/toastbox
Symfony 7 with AssetMapper
- Install the package:
composer require awesometoast/toastbox
- The package automatically registers with AssetMapper. You can import it in your JavaScript:
import toastbox from '@awesometoast/toastbox'; // Or import with locales import toastbox from '@awesometoast/toastbox/all'; // Or import locales separately import toastbox from '@awesometoast/toastbox'; import '@awesometoast/toastbox/locales';
- Use in your Twig templates:
{% block javascripts %}
{{ parent() }}
<script type="module">
import toastbox from '@awesometoast/toastbox';
// Your toastbox code here
toastbox.alert("Hello from Symfony!");
</script>
{% endblock %}
Laravel / Static HTML
For non-Symfony projects, you can use the dist files directly:
- If using Composer:
composer require awesometoast/toastbox
- Include the JavaScript file:
<!-- From vendor directory --> <script src="vendor/awesometoast/toastbox/dist/toastbox.js"></script> <!-- Or copy to your public assets --> <script src="assets/js/toastbox.js"></script>
Running Tests
Tests are run using Karma using the Mocha test adapter. To run the tests yourself, simply run:
npm install
within the project followed by:
npm test
Tests are run against the generated files contained in the /dist directory - regenerate those files and run the Karma tests by simply running Grunt:
grunt
License
(The MIT License)
Copyright (C) 2011-2022 by Nick Payne nick@kurai.co.uk (original Bootbox)
Copyright (C) 2025 by Awesometoast (Toastbox fork modifications)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
awesometoast/toastbox 适用场景与选型建议
awesometoast/toastbox 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 473 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ui」 「javascript」 「bootstrap」 「dialog」 「modal」 「prompt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 awesometoast/toastbox 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 awesometoast/toastbox 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 awesometoast/toastbox 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
Send events to a websocket real time engine though PHP
Custom fields for Kirby's add dialog. This plugin allows to define the fields shown on the page add dialog in a page's blueprint.
Views for the package MedicOneSystems Livewire Datatables with Bootstrap 4
统计信息
- 总下载量: 473
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-24