PHPackages                             sematico/laravel-shopify-flash - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sematico/laravel-shopify-flash

ActiveLibrary

sematico/laravel-shopify-flash
==============================

Shared Laravel + Inertia v3 + React package for Shopify App Bridge toasts and Polaris s-banner notices

v0.0.2(yesterday)05↑2900%MITTypeScriptPHP ^8.4CI passing

Since May 4Pushed yesterdayCompare

[ Source](https://github.com/alessandrotesoro/laravel-shopify-flash)[ Packagist](https://packagist.org/packages/sematico/laravel-shopify-flash)[ Docs](https://github.com/alessandrotesoro/laravel-shopify-flash)[ GitHub Sponsors](https://github.com/Sematico)[ RSS](/packages/sematico-laravel-shopify-flash/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (13)Versions (4)Used By (0)

Shopify Flash
=============

[](#shopify-flash)

[![Packagist Version](https://camo.githubusercontent.com/e1d74cf00e76f0e2a8f47ec7fb902cecc28350a93afe708cf21a56ee5fbc0586/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656d617469636f2f6c61726176656c2d73686f706966792d666c6173683f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sematico/laravel-shopify-flash)[![npm version](https://camo.githubusercontent.com/54b2f2b05fef0b6df8a63e1197218611c614a56f090cf67155af4bff9aa635c4/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f25343073656d617469636f25324673686f706966792d666c6173683f7374796c653d666c61742d737175617265)](https://www.npmjs.com/package/@sematico/shopify-flash)[![Tests](https://github.com/alessandrotesoro/laravel-shopify-flash/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/alessandrotesoro/laravel-shopify-flash/actions/workflows/run-tests.yml)[![License: MIT](https://camo.githubusercontent.com/7d217ebb91a61cb4d98e70dee31eb08e0a5f71bc518ebd4151a73c6fb1191d00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75653f7374796c653d666c61742d737175617265)](LICENSE.md)

Share Laravel flash responses with an Inertia.js React app and render them through Shopify App Bridge toasts and Polaris `` notices. The repository contains a Composer package for the backend and an npm package for the frontend.

PackageInstall from`sematico/laravel-shopify-flash`[Packagist](https://packagist.org/packages/sematico/laravel-shopify-flash)`@sematico/shopify-flash`[npm](https://www.npmjs.com/package/@sematico/shopify-flash)Requirements
------------

[](#requirements)

- PHP 8.4 or newer
- Laravel 11, 12, or 13
- `inertiajs/inertia-laravel` 3.0.5 or newer
- React 19
- `@inertiajs/core` and `@inertiajs/react` 3.x
- `@shopify/app-bridge-react` 4.x
- An ESM-capable frontend build

Installation
------------

[](#installation)

Install the backend package:

```
composer require sematico/laravel-shopify-flash
```

Install the React package:

```
npm install @sematico/shopify-flash
```

The Laravel service provider registers the response macros through package discovery. The npm package ships its compiled ESM bundle and TypeScript declarations.

Frontend setup
--------------

[](#frontend-setup)

Mount the provider, listener, interceptor, and banner container inside Shopify's App Bridge provider:

```
import {
  FlashHttpInterceptor,
  FlashListener,
  NoticesContainer,
  NoticesProvider,
  useNotices,
} from "@sematico/shopify-flash";

function FlashBridge({ children }: { children: React.ReactNode }) {
  const { add } = useNotices();

  return (

      {children}

  );
}

export function AppShell({ children }: { children: React.ReactNode }) {
  return (

      {children}

  );
}
```

`FlashListener` consumes Inertia v3 flash events. `FlashHttpInterceptor` consumes `JsonResponse::withFlash()` response envelopes and supplies fallback notices for common HTTP errors. Mount each once.

To add the Inertia flash type augmentation to your application, import the package's types from a declaration file you own:

```
// resources/js/types/shopify-flash.d.ts
import "@sematico/shopify-flash/types";
```

Backend usage
-------------

[](#backend-usage)

Short success messages can be sent as a toast:

```
return back()->withToast('File deleted');
```

Use a banner for errors, warnings, and longer messages:

```
use Sematico\ShopifyFlash\Payloads\BannerPayload;

return back()->withBanner(
    BannerPayload::warning(
        heading: 'Some products need attention',
        description: 'Review the products before continuing.',
    ),
);
```

`withFlash()` accepts a `ToastPayload`, a `BannerPayload`, or a `FlashEnvelope` containing both:

```
use Sematico\ShopifyFlash\Http\FlashEnvelope;
use Sematico\ShopifyFlash\Payloads\BannerPayload;
use Sematico\ShopifyFlash\Payloads\ToastPayload;

return back()->withFlash(new FlashEnvelope(
    toast: ToastPayload::success('Saved'),
    banner: BannerPayload::info('The import is still running.'),
));
```

The same `withFlash()` macro is available on `JsonResponse`. It adds a `notice` object to the JSON body for `FlashHttpInterceptor`:

```
return response()->json(['ok' => false])->withFlash(
    BannerPayload::critical('The upload could not be completed.'),
);
```

Payloads and actions
--------------------

[](#payloads-and-actions)

The PHP value objects mirror the TypeScript wire types:

- `ToastPayload::success()` and `ToastPayload::error()` create App Bridge toasts.
- `BannerPayload::info()`, `success()`, `warning()`, and `critical()` create Polaris banners.
- `ToastAction::link()` creates a safe URL action.
- `ToastAction::handler()` refers to a named client-side handler and accepts JSON-serializable parameters.
- `BannerAction::link()` creates a safe URL action. A banner supports at most two actions.
- `FlashEnvelope` carries a toast, a banner, or both.

Register a named handler in React before emitting a matching toast:

```
import { router } from "@inertiajs/react";
import { useFlashHandlers } from "@sematico/shopify-flash";

function ProductRow({ id }: { id: number }) {
  const { register } = useFlashHandlers();

  React.useEffect(
    () => register("product.restore", () => router.post(`/products/${id}/restore`)),
    [id, register],
  );

  return null;
}
```

For client-owned notices, use `useNotices()` or `useToast()` directly:

```
const { warning } = useNotices();
warning({ heading: "Check the selected products" });

const { success } = useToast();
success("File downloaded");
```

The package validates link actions and rejects unsafe URL schemes before navigation.

Development
-----------

[](#development)

```
composer install
composer validate --strict
composer test
composer analyse
composer format -- --test

npm ci
npm run typecheck
npm run lint
npm test
npm run build
npm pack --dry-run
```

The npm package is built from `js/index.ts` into `dist/`. It publishes the compiled bundle, declarations, source TypeScript files, and the project documentation.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~111 days

Total

2

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af4bb5092564de3865e7e14ffa426b904cbd16f780999437d7f083a8bf916291?d=identicon)[alessandrotesoro](/maintainers/alessandrotesoro)

---

Top Contributors

[![alessandrotesoro](https://avatars.githubusercontent.com/u/1590958?v=4)](https://github.com/alessandrotesoro "alessandrotesoro (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (14 commits)")

---

Tags

laravelinertiaflashshopifypolarissematicoapp-bridge

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sematico-laravel-shopify-flash/health.svg)

```
[![Health](https://phpackages.com/badges/sematico-laravel-shopify-flash/health.svg)](https://phpackages.com/packages/sematico-laravel-shopify-flash)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

13.0k107.5M1.6k](/packages/spatie-laravel-permission)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k12.6M141](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k5.4M50](/packages/spatie-laravel-pdf)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

46273.9k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

25060.1k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
