Repository navigation
v1.1.0
ToastKit 1.1.0 🎉
ToastKit 1.1.0 brings richer native animations, first-class progress and loading states, reusable toast presets, and a cleaner exception API.
✨ What's New
New Animations
ToastKit now includes four new native animations:
snappoprevealbounce
You can also control the animation direction independently:
Toast::error('Connection failed')
->animation('snap')
->direction('left')
->show();Supported directions are auto, left, right, top, and bottom.
ToastKit also respects reduced-motion platform settings where supported.
Progress Toasts
ToastKit now has first-class support for determinate progress using values from 0 to 100.
$id = Toast::info('Uploading...')
->persistent()
->progress(0)
->show();
Toast::update($id)
->progress(65)
->message('Uploading 65%...')
->show();
Toast::update($id)
->progress(100)
->success()
->message('Upload complete')
->duration(2000)
->show();Progress updates happen in place without replacing the existing toast.
Loading States
For operations where progress is unknown, you can now display a native indeterminate loading indicator.
$id = Toast::info('Connecting...')
->persistent()
->loading()
->show();
Toast::update($id)
->loading(false)
->success()
->message('Connected')
->duration(1500)
->show();Use progress() for determinate progress and loading() for indeterminate operations.
Reusable Toast Presets
You can now define toast styles once and reuse them throughout your application.
Toast::definePreset('payment-success', fn ($toast) => $toast
->success()
->icon('check_circle')
->animation('reveal')
->position('top')
->duration(3000)
);Then use the preset anywhere:
Toast::preset('payment-success')
->message('Payment received')
->show();Every Toast::preset() call creates a fresh toast builder, so state is never shared between toast instances.
Preset configuration can also be overridden for individual screens:
Toast::preset('payment-success')
->message('Payment received')
->position('bottom')
->animation('pop')
->duration(5000)
->show();For larger applications, presets can be organized in a dedicated App\Toasts\ToastPresets class and registered from your application's service provider.
ToastKit Exception Hierarchy
ToastKit now provides a package-specific exception hierarchy with ToastKitException as the base exception.
use Victorycodedev\ToastKit\Exceptions\ToastKitException;
try {
Toast::preset('payment-success')->show();
} catch (ToastKitException $exception) {
report($exception);
}This gives applications a single exception type they can catch for errors intentionally raised by ToastKit, while still allowing more specific exceptions when needed.
Improved Toast Updates
Sparse updates continue to preserve the existing toast configuration while allowing progress and loading states to be changed independently.
Toast::update($id)
->progress(0)
->loading(false)
->show();Only the properties explicitly supplied to update() are changed.
🎬 Available Animations
ToastKit now supports:
fadeslidescalespringsnappoprevealbounce
📱 Compatibility
- PHP 8.3+
- NativePHP Mobile 4.1+
- Android API 29+
- iOS 18+
📦 Upgrade
composer require victorycodedev/toastkit:^1.1Since ToastKit contains native Android and iOS code, rebuild your NativePHP application after upgrading:
php artisan native:run⚠️ Exception Migration Note
ToastKit exceptions now extend ToastKitException instead of PHP's InvalidArgumentException.
If your application previously caught InvalidArgumentException specifically for ToastKit calls, update it to catch:
use Victorycodedev\ToastKit\Exceptions\ToastKitException;Thanks to everyone using ToastKit, sharing feedback, and helping make it better. 🚀