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. stats4sd/laravel-shiny-loader

ActiveLibrary

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

This is my package laravel-shiny-loader

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

Since Sep 11Pushed 5d 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 today

READMEChangelog (2)Dependencies (13)Versions (5)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:

```
composer require stats4sd/laravel-shiny-loader
```

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"

## URL of the Shiny app. The Shiny app should be available at this URL, as it will be embedded into an iframe within one of your Laravel app pages
SHINY_APP_URL="http://url-of-shiny-app.com"

## 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"
```

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

43

—

FairBetter than 91% of packages

Maintenance91

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.9% 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 ~90 days

Total

2

Last Release

100d 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 (15 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

[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13662.4k1](/packages/ralphjsmit-laravel-helpers)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

136.9k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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