reactjs / react-php-v8js

PHP library that renders React components on the server
Other
1.33k stars 127 forks source link

Any boilerplate? #33

Closed SilentImp closed 6 years ago

SilentImp commented 6 years ago

Hi, is there any examples? What exactly should I pass as $react_source? react.js from https://github.com/facebook/react/releases? Or webpack'ed chunk with react and react-dom? What is $app_source? Entrance point? Should it be webpack bundle? Or plain components scripts? Should they be transpiled with babel first?

Some boilerplate project needed. At the moment I can't start work by any means.

zpao commented 6 years ago

There's an example at the project root with a readme answering some of your questions. It uses browserify but same concepts. react_source must expose globals (use browser bundles). Your code must be compiled such that it runs directly in V8 and it should make use of the React* globals. All of your components you might want to render from PHP would need to be globally scoped.

Note that this project is not actively developed nor supported, it is mostly a proof of concept demonstrating how to do React server rendering with PHP.