PHPackages                             stats4sd/laravel-shiny-loader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stats4sd/laravel-shiny-loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stats4sd/laravel-shiny-loader
=============================

This is my package laravel-shiny-loader

v1.1.1(3mo ago)051[2 PRs](https://github.com/stats4sd/laravel-shiny-loader/pulls)MITPHPPHP ^8.4CI passing

Since Sep 11Pushed 3w agoCompare

[ Source](https://github.com/stats4sd/laravel-shiny-loader)[ Packagist](https://packagist.org/packages/stats4sd/laravel-shiny-loader)[ Docs](https://github.com/stats4sd/laravel-shiny-loader)[ GitHub Sponsors]()[ RSS](/packages/stats4sd-laravel-shiny-loader/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (26)Versions (7)Used By (0)

Laravel Shiny Loader
====================

[](#laravel-shiny-loader)

[![Latest Version on Packagist](https://camo.githubusercontent.com/da9e374b655818a76975c80c76d429e0c27ccb151f1c6a1f9bc8269711598c33/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746174733473642f6c61726176656c2d7368696e792d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stats4sd/laravel-shiny-loader)[![Total Downloads](https://camo.githubusercontent.com/23f6c71a52f021394f15a6f1965e2e2a7a8b8900bf53df86916e23bffebc95a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746174733473642f6c61726176656c2d7368696e792d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stats4sd/laravel-shiny-loader)

A Laravel package that lets you embed Shiny apps into your Laravel application with iFrames.

...But surely that doesn't need a package? You're right - you can just use an iFrame and point it at your Shiny app (as long as the app is publicly accessible).

This package does more than that - it provides a way for Laravel to communicate with the Shiny app to:

- pass initialisation data into the app
- ensure that the current user is authenticated before loading the app.

How does it work?
-----------------

[](#how-does-it-work)

TODO: Update and bring over documentation from :

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

[](#installation)

You can install the package via composer. You will also need to publish the config file, so you can specify the urls of the Shiny apps to embed:

```
composer require stats4sd/laravel-shiny-loader
php artisan vendor:publish --tag shiny-loader-config

```

Add the following properties to your .env file:

```
## Path to the directory where shiny apps are served from. For example, if you have shiny apps in /srv/shiny-server/app1 and /srv/shiny-server/app2, set this to /srv/shiny-server
SHINY_APP_PATH="/path/to/shiny/app/container"

## A secret key that both the Laravel app and the Shiny app know. This is used to authenticate requests from Laravel to the Shiny app
## This can be literally any string; the only requirement is that it is also included in the Shiny app's configuration
SHINY_AUTH_KEY="change-me"

## Then add the URL of every shiny app to be embedded. E.g., to match the 'example' entries in the config file you just published:
SHINY_APP_URL_MONITORING="http://127.0.0.1:7008"
SHINY_APP_URL_ANALYSIS="http://127.0.0.1:7009"

```

Note

The shiny app needs to be available at the given url independantly of your Laravel app. This doesn't mean users can actually reach the app at this url; we recommend that you use some approach to prevent users just going directly to this url. The most secure approach is to develop your Shiny app to require POST data from the Laravel app before rendering sensitive content.

TODO: tidy up R Shiny side of this interaction and share documentation

Use
---

[](#use)

To enable authentication, you need to set up a route in your Laravel app.

This package provides a Route Macro to make this easy. In your main `routes/web.php` (or where-ever you register your routes), add the following:

```
use Illuminate\Support\Facades\Route;

Route::shiny()
```

If you want to add extra middleware to the route (for example, to ensure the user is authenticated, or has a specific role), you can do so by wrapping the `Route::shiny()` call in a middleware group. E.g:

```
use Illuminate\Support\Facades\Route;

Route::middleware(['auth', 'role:admin'])->group(function () {
    Route::shiny();
});
```

This will ensure that, even if the user could somehow get to the page that renders the Shiny app, the app will not receive the POST request to confirm the user is authenticated unless your middleware is passed.

The main way to use the package is by adding the ShinyIframe component to your page. It requires a `$shinyAppUrl` - the url of the Shiny app you want to embed. You may optionally add `$postData` - an array of data to pass to the Shiny app when it loads.

```

```

You can use the `$postData` to pass any data you want from Laravel to the Shiny app. For example:

- The current user's ID or email address;
- The ID of a resource the user is viewing in Laravel, so the Shiny app can load data related to that resource;
- Any other arbitrary data you want to pass to the Shiny app.

TODO: add refs to documentation on how to setup the Shiny app to receive the postData.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Dave Mills](https://github.com/dave-mills)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.6% of commits — single point of failure

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 ~98 days

Total

3

Last Release

91d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a7ba5ca40fde83339632231db5f6a95522c1de137f0029a338a5d90fa449a46?d=identicon)[dave-mills](/maintainers/dave-mills)

---

Top Contributors

[![dave-mills](https://avatars.githubusercontent.com/u/5711101?v=4)](https://github.com/dave-mills "dave-mills (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelStatistics for Sustainable Developmentlaravel-shiny-loader

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/stats4sd-laravel-shiny-loader/health.svg)

```
[![Health](https://phpackages.com/badges/stats4sd-laravel-shiny-loader/health.svg)](https://phpackages.com/packages/stats4sd-laravel-shiny-loader)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k33.0M880](/packages/spatie-laravel-data)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.3M42](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

328482.0k25](/packages/codewithdennis-filament-select-tree)[nativephp/desktop

NativePHP for Desktop

38133.6k8](/packages/nativephp-desktop)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124581.3k](/packages/worksome-exchange)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3913.7k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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