PHPackages                             sasab/react-bridge - 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. [Framework](/categories/framework)
4. /
5. sasab/react-bridge

ActiveLibrary[Framework](/categories/framework)

sasab/react-bridge
==================

A small library small library that helps you make hybrid by integrating React.js into full stack PHP frameworks

1.1.1(7y ago)511MITPHPPHP ^7.1

Since Nov 13Pushed 7y ago2 watchersCompare

[ Source](https://github.com/sasa-b/react-bridge)[ Packagist](https://packagist.org/packages/sasab/react-bridge)[ RSS](/packages/sasab-react-bridge/feed)WikiDiscussions master Synced 3d ago

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

React Bridge
------------

[](#react-bridge)

A small library that helps you make hybrid apps by integrating React.js into full stack PHP frameworks.

Inspired by **react-rails** gem

### Getting started

[](#getting-started)

All you need to do to integrate React into your favorite full stack MVC project is:

1. `npm install react` or `yarn add react`
2. `composer require sasab/react-bridge`
3. Call the `react_component` or `rc` function somewhere in your views
4. Finally, add the generated file(s) to your bundle or directly into your html via the script tag

If you are a **Laravel** user you can start using it out of the box, it uses Laravel's folder structure by default.

The "bundling" `react.js` file will be generated in `/resources/assets/js` and it will look for your React component files in the `/resources/assets/js/components` folder by default.

This function will detect the environment of your app from the `.env` file, if it is in *production* it will just return the `` file required by React. If it is in development it will write/append to the `react.js` file.

You can override the defaults by either using the `.env` file or providing the overrides as the third param to the `react_component` function.

```
    // Data provided from the server that will be passed as props to your component
    $props = ['foo' => 'bar'];

    // Default options
