Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Toast Laravel Package

jeremykenedy/laravel-toast

Powerful, highly configurable toast notifications for Laravel with 56 animations, 19 per-toast props, RTL support, dark mode, and full CSS/frontend framework parity across Tailwind, Bootstrap, Livewire, Vue, React, and Svelte.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Modular Design: Multiple frontend targets (Blade, Livewire, Vue, React, Svelte) and CSS frameworks (Tailwind v4, Bootstrap 4/5) remain first-class; v3.1.0 also ships a settings component for each target, so the admin surface matches whatever rendering layer the app already uses.
    • Decoupled Notifications: Toast logic stays abstracted from rendering; the new color system is layered on top as data (colors_css on the payload, injected via a single <style id="toast-colors"> tag) rather than baked into components.
    • Opt-In by Default: v3.1.0 registers no routes, creates no table, and changes no rendering until TOAST_SETTINGS_ENABLED=true. This preserves the existing "drop-in UI layer" posture and keeps the blast radius of the upgrade at zero for teams that don't want the settings feature.
    • Config Precedence Is Explicit: Saved settings merge over config/toast.php and .env, with per-value fallback to config. This is a predictable, inspectable resolution order rather than magic.
    • Security Posture Is Defensible: Closed-by-default gate, deny-if-undefined, form request authorization, unknown-key rejection with 422, hex-only color validation with normalization, and app middleware running before the gate.
  • Cons:

    • Scope Expansion: The package is no longer purely a presentation layer. It now owns persistence (toast_settings table), routing, authorization integration, and an admin UI. That is a materially larger architectural commitment than the v3.0.x footprint and pulls the package into the "configuration management" domain.
    • Config Now Lives in Two Places: .env/config and a database row. Any team that treats config as code (GitOps, environment parity, change review) has to decide how the DB layer fits, because saved settings are not version-controlled and are invisible to code review.
    • Laravel-Centric (unchanged): Service container and event coupling still rules out Symfony/Lumen without rework.
    • Inline Style Emission: Colors are delivered as a <style> tag, which will collide with a strict Content-Security-Policy (style-src) unless a nonce or hash strategy is adopted.
    • Localization Debt: Settings panel strings are English-only; non-English admin users see fallback English. Acceptable for internal tooling, a visible gap for customer-facing admin surfaces.

Integration Feasibility

  • High for Laravel Apps: Unchanged trigger surface (Toast::success(), notifications, events). Requirements are now explicit: PHP 8.2+, Laravel 10–13, Livewire 3 or 4 when used.
  • Upgrade Cost Is Low but Not Zero:
    • No required steps for a standard app, and no breaking changes to public API, config keys, view names, published paths, or payload keys.
    • One real trap: apps that published toast-views must merge the new data-toast-type and data-toast-part attributes into their copies, or configured colors silently will not reach the markup. This is a correctness issue that fails quietly, not loudly.
    • One internal break: HasInstallPrompts::$font is now the FONT constant. Only affects code that read or overrode that protected property.
    • Direct upgrade window is narrow: v3.0.0 and v3.0.1 only. From v1/v2 you must traverse the v3.0.0 steps first.
  • Frontend Stack Alignment: JS containers now need npm run build if imported from vendor/; copied components must import and call applyToastColors(toast.colors_css). Blade/Livewire users get the settings views prebuilt for all three CSS frameworks.
  • Database/Queue Support: Queued-toast support is still not native; the settings feature adds persistence for styling, not for toast delivery state.

Technical Risk

  • Silent Misconfiguration Surface: Gate undefined → everyone denied (safe but confusing); --settings-page without --settings-layout → production page loads Tailwind/Bootstrap from a public CDN (a runtime dependency on a third party and a supply-chain/CSP concern).
  • Published-View Drift: Color configuration depends on attributes the app may have overwritten in v3.0.x. This is the single most likely "it looks broken but tests pass" scenario in the upgrade.
  • Config Drift Across Environments: A saved DB row means staging and production can render differently with identical code and .env. Without added governance (audit log, export/import, migration-seeded defaults), this is a new class of production-only surprise.
  • CSP Compatibility: Inline <style id="toast-colors"> requires CSP allowance. Teams with strict policies need a nonce/hash plan before enabling.
  • Tailwind Purge Risk: Previews need the package views included in the host build via the existing @source line. If the host's Tailwind config missed it, previews render unstyled — a support ticket, not a bug.
  • Maturity Signal Improved but Unchanged in Kind: 413 PHP tests / 774 assertions, 78 frontend tests, 11 Chromium tests, a full PHP 8.2–8.5 × Laravel 10–13 × Livewire 3–4 matrix, and Codacy grade A with zero issues is a meaningful quality jump. It still does not substitute for third-party production adoption; low stars/dependents remain a bus-factor consideration.
  • UX Rough Edges in the New Surface: Framework-neutral CSS in JS components diverges visually from the host CSS framework, and Reset does not confirm — both are user-error vectors for an authorized-but-untrained operator.

Key Questions

  1. Do we actually need the settings UI? If only developers change toast styling, stay on config and take the zero-risk path.
  2. Who is the authorized persona? Is manage-toast-settings mapped to an existing permission (e.g., manage-site), and is that permission itself reviewed? An undefined gate denies everyone, which is safe but will look like an outage if nobody defines it.
  3. Have we published toast views? If yes, who owns merging data-toast-type/data-toast-part, and how do we verify colors actually land?
  4. How does the DB row interact with our config-as-code discipline? Do we need export/import, an audit trail, or to treat the row as ephemeral and re-seed it per environment?
  5. What is our CSP posture? Will <style id="toast-colors"> pass style-src, or do we need a nonce?
  6. Do we need a Blade layout for the settings page in production? The CDN fallback is out of policy for most enterprise environments.
  7. Do we have non-English administrators? If so, accept English-only UI for now or plan a translation contribution/fork.

Integration Approach

Stack Fit

  • Best Fit:
    • Laravel 10–13 + Livewire 3/4: <livewire:toast-settings /> is the lowest-effort, highest-fidelity path; prebuilt Tailwind v4 / Bootstrap 5 / Bootstrap 4 views.
    • Laravel + Blade with an existing layout: @toastSettings or @include('toast::settings') inside your own layout — avoids the CDN fallback entirely.
    • Vue/React/Svelte shops: Components exist, but budget for framework-neutral CSS that won't match your design system.
  • Workarounds Needed:
    • Strict CSP: nonce or hash the injected style tag, or precompute colors into a build-time stylesheet.
    • Non-English admin users: translate the published views locally; upstream is English-only.
    • Published-and-modified views: manual attribute merge; no automated path.
    • Symfony/Lumen: still not supported.

Migration Path

  1. Triage:
    • Confirm versions (PHP 8.2+, Laravel 10–13, Livewire 3/4).
    • Determine whether toast-views was ever published — this decides whether the upgrade is composer update or composer update plus a view merge.
    • Confirm current version; if v1/v2, plan the v3.0.0 chain first.
  2. Upgrade (mandatory minimum):
    • composer update jeremykenedy/laravel-toast → php artisan view:clear → merge view attributes if published → npm run build if importing JS containers from vendor/.
    • Verify existing toasts render identically; colors must be absent and behavior unchanged when the feature is off.
  3. Enable Settings Deliberately (optional):
    • Non-production first: php artisan toast:update --settings --settings-page --settings-layout=layouts.app --settings-middleware=web,auth --settings-gate=manage-toast-settings → review the published migration → php artisan migrate.
    • Define the gate in code and get it reviewed like any authorization change.
  4. Rollout:
    • Phase 1: Enable settings and page in staging; have the intended operator drive the live preview across light/dark and all four toast types.
    • Phase 2: Production enable with a Blade layout configured (never the CDN fallback), gate mapped to an existing permission, and CSP verified.
    • Phase 3: Decide the config-drift policy — document that saved settings override config, and record which values are DB-managed vs. code-managed.

Compatibility

  • Laravel: 10 through 13 (CI-verified). Note this raises the floor from the prior assessment's "9+".
  • PHP: 8.2+ (was 8.0+).
  • Livewire: 3 or 4 when used; installation without Livewire is CI-tested.
  • Frontend: Vue/React/Svelte consumers rebuilt after upgrade; copied components need applyToastColors + toast.colors_css.
  • Conflict Risks:
    • Existing inline-style CSP rules blocking <style id="toast-colors">.
    • Duplicate toast/admin-UI libraries (e.g., a pre-existing settings screen for the same purpose).
    • Tailwind purge config missing the package's @source line → unstyled previews only.
    • Route collisions on GET /toast/settings in apps with a catch-all route — review route order after registration.

Sequencing

  1. Version and published-view audit; snapshot current toast behavior.
  2. composer update + view:clear + asset rebuild; regression-check existing toasts.
  3. Non-prod enable of settings + page; review migration; run it; define gate.
  4. CSP and layout validation on a real page render (not just tests).
  5. Gate/permission review with whoever owns authorization.
  6. Operator handover (brand/marketing/design) with the known-limitations list attached.
  7. Production enable; record rollback switches in the runbook.

Operational Impact

Maintenance

  • Pros:
    • MIT License: Fork-friendly if upstream stalls.
    • Zero-Step Upgrade: No required steps, no public-API breaks; the default-off design means most apps get a no-op upgrade.
    • Tooling Investment: PHPCS, PHPMD, ESLint, Stylelint, markdownlint, Codacy, pinned workflow actions, and a Laravel 10 $casts compatibility fix signal active, disciplined maintenance.
    • Documented Rollback: Remove TOAST_SETTINGS_ENABLED to revert to config (row preserved), or roll back the migration to drop the table; composer can pin v3.0.1.
  • Cons:
    • New Artifact You Now Own: A migration, a table, routes, a view, and a gate in your repository. Published code is your code — upstream fixes require manual re-merge.
    • Two Sources of Truth: DB-stored styling plus config means two places to check when a toast looks wrong. Support burden shifts from "the CSS is broken" to "someone changed a color six weeks ago."
    • Single-Maintainer Risk (unchanged): Low dependents and stars still imply bus-factor exposure, now over a larger surface area.
    • English-Only Admin Strings: Ongoing localization debt if non-English operators use the panel.

Support

  • Documentation: Stronger than v3.0.x — dedicated docs/settings.md, README and CHANGELOG updates, screenshots for all three CSS frameworks, and a documented upgrade/rollback path. Troubleshooting for cross-framework edge cases is still thin.
  • New Support Playbooks Needed:
    • "Settings page 403" → gate undefined or user lacks permission (deny-by-default is working as intended).
    • "Colors saved but not applied" → published views missing data-toast-part / data-toast-type, or host Tailwind missing the @source line.
    • "Preview unstyled" → Tailwind build excludes package views.
    • "Production looks different from staging" → toast_settings row differs; disable the flag or align the rows.
  • Community: No public issue tracker activity; treat Laravel's own channels plus internal runbooks as primary support. Vendor lock-in stays low.

Scaling

  • Performance:
    • Toast rendering remains client-side and stateless per request.
    • Settings feature adds one small-table read when enabled; negligible at any realistic scale, and irrelevant when the feature is off.
    • Injected <style> tags are per-page, not per-toast-volume — no scaling concern, but do verify they aren't duplicated under heavy stacking.
  • Concurrency / Multi-Tenancy: A single settings row is effectively global configuration. Multi-tenant apps needing per-tenant branding would require extending the package — flag this now if tenant-specific theming is on the roadmap.
  • Horizontal Scaling: Unchanged; no sticky sessions, no shared state beyond the settings row.

Failure Modes

Failure Scenario Impact Mitigation
Published views not updated with data-toast-part Configured colors silently ignored Diff published views against v3.1.0 before enabling colors
Gate never defined Settings page denies all users (looks like an outage) Define and code-review the gate before enabling the page
--settings-page without --settings-layout Production page loads Tailwind/Bootstrap from a public CDN Always pass --settings-layout; lint for CDN references in prod builds
Strict CSP blocks <style id="toast-colors"> Colors don't apply; possible console noise Nonce/hash strategy or precomputed stylesheet
Saved settings diverge across environments Prod/staging render differently from identical code Export/import rows, seed defaults, or restrict DB overrides to non-prod
Migration run without review Unintended schema change in prod Review the published migration; roll back via explicit --path
Malformed color submitted Rejected with 422 Expected; no action — confirm operators understand error surface
Host Tailwind missing @source Preview panel unstyled; live preview misleading Verify build config; test in a real browser, not just CI
Upstream stall / single maintainer No fixes for future Laravel changes MIT fork; keep the toast layer thin so replacement is cheap
Reset pressed by mistake Instant loss of custom palette, no confirmation Tell operators; export settings before large changes

Ramp-Up

  • Developer Onboarding:
    • Upgrade: ~1 hour for a standard app (composer update, view clear, asset rebuild, regression check).
    • View merge (if published): 1–3 hours including verification that colors land.
    • Settings enablement: 2–4 hours including migration review, gate definition, CSP validation, and route inspection.
  • New Non-Developer Persona: v3.1.0 introduces an authorized operator (design/brand/marketing) who can change toast appearance and behavior in production without a deploy. Onboard them explicitly:
    • Live preview is light/dark aware — use it, don't guess.
    • "Default" means fall back to the CSS framework's own color, not "reset to my previous color."
    • Reset has no confirmation.
    • Save is immediate and global — no staging step inside the UI.
  • Training Needed:
    • Backend: Laravel event/notification patterns; settings precedence (saved > config > .env).
    • Frontend: applyToastColors for copied components; npm run build for vendor imports.
    • Operators: 30-minute walkthrough of colors, behaviors, preview, and reset.
  • Documentation Needs:
    • Internal wiki: gate ownership, which values are DB-managed vs. code-managed, disable-the-flag runbook, view-merge guide.
    • Storybook (or equivalent) examples for Vue/React/Svelte so the framework-neutral CSS gap is visible before it surprises anyone.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core