PHPackages                             isakzhanov-r/laravel-ssr - 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. isakzhanov-r/laravel-ssr

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

isakzhanov-r/laravel-ssr
========================

Packege for rendering JavaScript in Laravel application

v1.1.1(1y ago)75.3kMITPHPPHP ^8.0|^7.3

Since Mar 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/isakzhanov-r/laravel-ssr)[ Packagist](https://packagist.org/packages/isakzhanov-r/laravel-ssr)[ RSS](/packages/isakzhanov-r-laravel-ssr/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (19)Used By (0)

Server Side Rendering
---------------------

[](#server-side-rendering)

This helper allows you to render the SPA using node js for search bots.

 [![Total Downloads](https://camo.githubusercontent.com/c83030811a9b55750eb9546eb232d273826a17939f1b15e9dba4ea4da89aba96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6973616b7a68616e6f762d722f6c61726176656c2d7373722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/isakzhanov-r/laravel-ssr) [![Latest Stable Version](https://camo.githubusercontent.com/0a08bd676e982b070badff2254d4c02000d9154c6567f2b650cefe5736f3b8e0/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d7373722f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/isakzhanov-r/laravel-ssr) [![Latest Unstable Version](https://camo.githubusercontent.com/e74c36e45c7ccc736756e248ffd935e62ede4d6540b58b18200924a1bbacf052/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d7373722f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/isakzhanov-r/laravel-ssr) [![License](https://camo.githubusercontent.com/0b08168a376e42b2485d5aaffc48cf4a689e71ede0ca21f0dff87f8984253019/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d7373722f6c6963656e73653f666f726d61743d666c61742d737175617265)](LICENSE)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Methods ](#methods)
    - [Examples](#examples)
- [License](#license)

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

[](#installation)

To get the latest version of Laravel Server Side Rendering package, simply require the project using [Composer](https://getcomposer.org):

```
composer require isakzhanov-r/laravel-ssr

```

Instead, you can, of course, manually update the dependency block `require` in `composer.json` and run `composer update` if you want to:

```
{
    "require": {
        "isakzhanov-r/laravel-ssr": "^1.0"
    }
}
```

If you don't use auto-discovery, add the `ServiceProvider` to the providers array in `config/app.php`:

```
IsakzhanovR\Ssr\ServiceProvider::class;
```

Configuration
-------------

[](#configuration)

The package is configured to use node, since it is probably already installed on your system. If you need to change the configuration file you can publish it for modification (ie. interface to specific class):

```
php artisan vendor:publish --provider="IsakzhanovR\Ssr\ServiceProvider"

```

The configuration file contains two settings: the path where temporary files will be saved by default `"storage/app/ssr"` and the path to the `node` executable file

```
return [
    'temp_storage' => [
        'disk' => 'local', // filesystem disk
        'path' => 'ssr',   // directory
    ],
    'node_path'    => env('NODE_PATH', ''), // default /usr/bin/node
];
```

You can check on the server where the node is located by running the `which node` command and add the `NODE_PATH` key to the environment file

Usage
-----

[](#usage)

You will need two files for two scenarios: server and client. There is an example of a server script in the `tests` folder

```
mix
    .js('resources/js/server.js', 'public/js')
    .js('resources/js/client.js', 'public/js');
```

The server script must be passed to the ssr function, and the client script must be loaded manually. The package assumes that you are using Laravel Mix, and will resolve the path for you. I use as follows:

```
@section('content')
    {!! ssr()
            ->entry('js/server.js')
            ->fallback('')
            ->setData(compact('titles'))
            ->render()  !!}
@endsection

@section('scripts')

@endsection
```

\###Methods The `entry()` method takes the path to the server file argument.js, you can also pass the file path to the `ssr()` method

```
{!! ssr('js/server.js') !!}  ===  {!! ssr()->entry('js/server.js') !!}
```

The `fallback()` method is required if there are errors in the production process during rendering, this method will return the div to which the client application will be mounted.

The `setData()` method is required for transferring data to the server.js takes an array as an argument.

The `render ()` method renders html from a js file ###Examples Example index blade

```

        My server side rendered app

        {!!
        ssr(mix('server.js'))
        ->setData(compact('news','posts'))
        ->render()
        !!}

```

Example app.js

```
import Vue from 'vue';
import store from './store/index';
import router from './routes/index';
import App from './components/App';

export default new Vue({
    store,
    router,
    render: h => h(App)
});
```

Example server.js

```
import app from './app';
import renderVueComponentToString from 'vue-server-renderer/basic';

app.$store.commit('SetNews', {news: news});
app.$store.commit('SetPosts', {posts: posts});

app.$router.push(url.path);

renderVueComponentToString(app, (err, html) => {
    if (err) {
        throw new Error(err);
    }
    dispatch(html);
});
```

Example client.js

```
import app from './app';
import './../vue-client/plugins/bootstrap';

app.$store.commit('SetNews', {news: news});
app.$store.commit('SetPosts', {posts: posts});

app.$mount('#wrapper');
```

Try to include all plugins and packages that can use the `window` object in the `client.js` file because when rendering the server file, `node` will not find the `window object` and will return an error.

\##License This package is released under the [MIT License](LICENSE.md).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance47

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~109 days

Recently: every ~416 days

Total

18

Last Release

398d ago

PHP version history (2 changes)v1.0.0PHP ^7

v1.1.0PHP ^8.0|^7.3

### Community

Maintainers

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

---

Top Contributors

[![isakzhanov-r](https://avatars.githubusercontent.com/u/38492287?v=4)](https://github.com/isakzhanov-r "isakzhanov-r (29 commits)")

---

Tags

laravelserver-side-renderinglaravelSSRserver-side-renderingserver side rendering node

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/isakzhanov-r-laravel-ssr/health.svg)

```
[![Health](https://phpackages.com/badges/isakzhanov-r-laravel-ssr/health.svg)](https://phpackages.com/packages/isakzhanov-r-laravel-ssr)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[spatie/server-side-rendering

Server side rendering JavaScript in your PHP application

631780.3k3](/packages/spatie-server-side-rendering)[brexis/laravel-workflow

Integerate Symfony Workflow component into Laravel.

283125.6k](/packages/brexis-laravel-workflow)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)

PHPackages © 2026

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