Download the PHP package alexk/craft-react without Composer

On this page you can find all versions of the php package alexk/craft-react. 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 craft-react

Craft React

Craft CMS React Renderer lets you implement React.js client and server-side rendering in your Craft CMS projects.

It is an implementation of ReactBundle for CraftCMS. For a complete documentation of the core functionality and client examples, as well as problems related to the Renderer itself, please check out ReactBundle or Symfony React Sandbox.

Why Server-Side rendering?

By rendering your react components on the server, you not only increase performance and search engine readability for SEO but also enable users with slower connections to be able to access your information before your client bundle has completely loaded.

How it works

Please checkout the Walkthrough for a step by step explanation of the client and twig-side of this plugin. For a JSON-API, we recommend Elements API for Craft CMS.

Installation

To install the plugin, follow these instructions:

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Then tell Composer to load the plugin:

    composer require alexk/craft-react

In the Control Panel, go to Settings → Plugins and click the “Install” button for Craft React.

Setup

In the plugin settings, add the following entries:

Environment: "client_side", "server_side" or "both"

Server Bundle: "PATH_TO_SERVER_BUNDLE"

or override the settings globally in config/react.php

In your template, add the following TWIG-function where you want your react application to be rendered into:

In the props, pass whatever props you want to pass to your root component.

Serialization

In order to serialize your entries to create a store or props, the new twig function serialize(entry, schema = 'entry', group = 'default') has been introduced. This allows you to create a php file to serialize your entries. Files should be located in config/react and should be named [schema].php. If unspecified, the schema will default to entry.php and the group to default.

To use it in twig, just pass your current entry and use the result in your store:

This will use the file config/react/blog.php


All versions of craft-react with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0
limenius/react-renderer Version ^2.1.0
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 alexk/craft-react contains the following files

Loading the files please wait ....