PHPackages                             talyssonoc/react-laravel - 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. talyssonoc/react-laravel

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

talyssonoc/react-laravel
========================

Package to use ReactJS with Laravel

v0.11(10y ago)8944.9k90[10 issues](https://github.com/talyssonoc/react-laravel/issues)[2 PRs](https://github.com/talyssonoc/react-laravel/pulls)MITPHP

Since Apr 9Pushed 6y ago39 watchersCompare

[ Source](https://github.com/talyssonoc/react-laravel)[ Packagist](https://packagist.org/packages/talyssonoc/react-laravel)[ RSS](/packages/talyssonoc-react-laravel/feed)WikiDiscussions master Synced 1mo ago

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

[![Code Climate](https://camo.githubusercontent.com/cb45f357dd3177ccc714fb66e909acd9f4f66e98ad1127f55288c4e31a98dd9d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f74616c7973736f6e6f632f72656163742d6c61726176656c2f6261646765732f6770612e737667)](https://codeclimate.com/github/talyssonoc/react-laravel) [![Build Status](https://camo.githubusercontent.com/59d0a00e38d62e6d0b4551ded50f53981a56680c605b439228aa26d0b40df363/68747470733a2f2f7472617669732d63692e6f72672f74616c7973736f6e6f632f72656163742d6c61726176656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/talyssonoc/react-laravel)

react-laravel
=============

[](#react-laravel)

With `react-laravel` you'll be able to use [ReactJS](https://facebook.github.io/react/) components right from your Blade views, with optional server-side rendering, and use them on the client-side with React due to unobtrusive JavaScript.

Installation
============

[](#installation)

V8js dependency
---------------

[](#v8js-dependency)

It's important to know that `react-laravel` has an indirect dependency of the [v8js](https://pecl.php.net/package/v8js) PHP extension.

You can see how to install it here: [how to install v8js](install_v8js.md).

Composer
--------

[](#composer)

Set the `minimum-stability` of your `composer.json` to `dev`, adding this:

```
  "minimum-stability": "dev"
```

Then run:

```
  $ composer require talyssonoc/react-laravel:0.11
```

After that you should add this to your providers at the `config/app.php` file of your Laravel app:

```
  'React\ReactServiceProvider'
```

And then run:

```
  php artisan vendor:publish
```

And the `react.php` file will be available at the `config` folder of your app.

Usage
=====

[](#usage)

After the installation and configuration, you'll be able to use the `@react_component` directive in your views.

The `@react_component` directive accepts 3 arguments:

```
  @react_component([, props, options])

  //example
  @react_component('Message', [ 'title' => 'Hello, World' ], [ 'prerender' => true ])

  // example using namespaced component
  @react_component('Acme.Message', [ 'title' => 'Hello, World' ], [ 'prerender' => true ])
```

- `componentName`: Is the name of the global variable that holds your component. When using [Namespaced Components](https://facebook.github.io/react/docs/jsx-in-depth.html#namespaced-components) you may use dot-notation for the component name.
- `props`: Associative of the `props` that'll be passed to your component
- `options`: Associative array of options that you can pass to the `react-laravel`:
    - `prerender`: Tells react-laravel to render your component server-side, and then just *mount* it on the client-side. Default to **true**.
    - `tag`: The tag of the element that'll hold your component. Default to **'div'**.
    - *html attributes*: Any other valid HTML attribute that will be added to the wrapper element of your component. Example: `'id' => 'my_component'`.

All your components should be inside `public/js/components.js` (you can configure it, see below) and be global.

You must include `react.js`, `react-dom.js` and `react_ujs.js` (in this order) in your view. You can concatenate these files together using laravel-elixir.

`react-laravel` provides a ReactJS installation and the `react_us.js` file, they'll be at `public/vendor/react-laravel` folder after you install `react-laravel` and run:

```
  $ php artisan vendor:publish --force
```

For using the files provided by `react-laravel` and your `components.js` file, add this to your view:

```

```

If you'll use a different version from the one provided by react-laravel (see `composer.json`), you got to configure it (see below).

Configurations
==============

[](#configurations)

You can change settings to `react-laravel` at the `config/react.php` file:

```
  return [
    'source' => 'path_for_react.js',
    'dom-source' => 'path_for_react-dom.js',
    'dom-server-source' => 'path_for_react-dom-server.js',
    'components' => [ 'path_for_file_containing_your_components.js' ]
  ];
```

All of them are optional.

- `source`: defaults to `public/vendor/react-laravel/react.js`.
- `dom-source`: defaults to `public/vendor/react-laravel/react-dom.js`.
- `dom-server-source`: defaults to `public/vendor/react-laravel/react-dom-server.js`.
- `components`: defaults to `public/js/components.js`. Multiple components files may be specified here.

Your `components.js` file(s) should also be included at your view, and all your components must be at the `window` object.

Thanks
======

[](#thanks)

This package is inspired at [react-rails](https://github.com/reactjs/react-rails).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 83.2% 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 ~26 days

Recently: every ~55 days

Total

12

Last Release

3771d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/273001c8ba47c4bbee4d7bf6c549a5ba2cfbae86e321d53f528b9e525fc175c1?d=identicon)[talyssonoc](/maintainers/talyssonoc)

---

Top Contributors

[![talyssonoc](https://avatars.githubusercontent.com/u/4325587?v=4)](https://github.com/talyssonoc "talyssonoc (109 commits)")[![TomCaserta](https://avatars.githubusercontent.com/u/592309?v=4)](https://github.com/TomCaserta "TomCaserta (7 commits)")[![jimpeters](https://avatars.githubusercontent.com/u/1263441?v=4)](https://github.com/jimpeters "jimpeters (4 commits)")[![phaza](https://avatars.githubusercontent.com/u/4553?v=4)](https://github.com/phaza "phaza (3 commits)")[![willvincent](https://avatars.githubusercontent.com/u/689891?v=4)](https://github.com/willvincent "willvincent (2 commits)")[![awylie199](https://avatars.githubusercontent.com/u/12545202?v=4)](https://github.com/awylie199 "awylie199 (2 commits)")[![18601673727](https://avatars.githubusercontent.com/u/3302620?v=4)](https://github.com/18601673727 "18601673727 (2 commits)")[![janhohner](https://avatars.githubusercontent.com/u/649895?v=4)](https://github.com/janhohner "janhohner (1 commits)")[![rajikaimal](https://avatars.githubusercontent.com/u/8940086?v=4)](https://github.com/rajikaimal "rajikaimal (1 commits)")

---

Tags

laravelphpreactserver-side-renderinglaravelreactreactjs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/talyssonoc-react-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/talyssonoc-react-laravel/health.svg)](https://phpackages.com/packages/talyssonoc-react-laravel)
```

###  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)[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)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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