Download the PHP package yilinker/reactjs-serverside-renderer without Composer

On this page you can find all versions of the php package yilinker/reactjs-serverside-renderer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package reactjs-serverside-renderer

ReactJS server-side renderer

What does this bundle do:

  1. Allow reactjs usage with symfony twig
  2. Allow server side reactjs (polymorphic) rendering (OPTIONAL)

Requirements:

  1. Node.js >= v0.12
  2. NPM
  3. Grunt
  4. Webpack

This bundle allows symfony to utilize server side rendering (for SEO) for reactjs. For this to work, a nodejs express server is used to return a string representing the static HTML of the initial reactjs page. This is achieved by sending an HTTP request to the nodejs express server.

Once the page is loaded into the browser, the client side reactjs kicks in and the javascript magic begins using the available webpack bundled reactjs files.

This bundle also a Twig extension to allow react to be used directly with your twig templates. You need not enable the server side renderer to make use of this feature.

React Tags

There are currently two flavors of custom twig tags for ReactJS, one for with props and another for without.

With Props

Syntax:

Ex:

Note that the entire statement is wrapped around two curly braces, the props with a pair of curly braces. A pipe ('|') is also present between the props and the react function containing the component name as the parameter.

Without Props

Syntax:

Ex:

Syntax is the same as the one before but without the props and the pipe character.

ReactJS in Development Environments

Most of the ReactJS Components that we will be creating would use the JSX sub-language to make the development process painless and fast. Unfortunately, no browser in the world understands what JSX is so we have to transpile (translate + compile) it first to regular Javascript before we can see the component in action. This is where webpack comes in.

Installation

A. Add the react bundle in your AppKernel.php file

B. Configure the bundle by adding the following into app/config/config.yml of your Symfony2 application.

C. Navigate to the Nodejs directory and run npm install to install the bundle specific dependencies

D. Add a package.json file to the root of your application and add the following dependencies:

Again run, npm install but this time at the root of the application to install the application node dependencies

E. Create a Gruntfile.js at the root of the application and add the following webpack block:

Read more about creating a Gruntfile here: http://gruntjs.com/sample-gruntfile

F. Move react templating files from the bundle to the symfony web directory:

Usage

Using React with TWIG

what are you looking at?

All you have to do to reference reactjs in your pages is to:

See the example map file and react component files in https://github.com/nelsoft-easyshop/react-serverside-renderer/tree/master/Resources/public/example

Note that if the nodejs server is not running, then you won't have server side rendering enabled but your app will still work. In other words, your app won't be indexable but you can use it as it is. This is useful when your working on your dev environment.

Server Side Renderer Usage

Navigate to the assets directory of your application and then from here execute server.js in the bundle For example:

Note that you don't have to start the SSR server to make the react integration work. You only need it if you want server side rendering, which is usually just in the production environment.

Pro-tip:

You can make the execution step faster by creating an npm run-script for server.js:

A. At the package.json in the root of the application, add the following script commands:

B. At the package.json in yilinker/reactjs-serverside-renderer/Nodejs/, add a start script that performs the appropriate directory change command and the node initiation command. Note, you will most likely have to modify the commands a bit depending on how your folders are structured.

C. You can then simply run npm run-script react-start at the root of your symfony application


All versions of reactjs-serverside-renderer with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yilinker/reactjs-serverside-renderer contains the following files

Loading the files please wait ....