Download the PHP package geekycodelab/wp_react_loader without Composer

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

WpReactLoader - A Composer Library for WordPress Developers

WpReactLoader is a composer library designed to simplify the process of loading React frontend projects in WordPress and passing data to them, a process known as localizing the script.

WpReactLoader solves the problem where a script may be manipulating the DOM after the page is loaded and you receive an error like this:

Features

Installation

To install WpReactLoader, you need to have Composer installed on your machine. If you don't have it installed, you can download it from here.

Once you have Composer installed, you can install WpReactLoader by running the following command in your terminal:

Usage

After installing the library, you can use it in your WordPress plugin or theme like this:

This will load the React application from the specified JavaScript file and pass the specified data in a global JS variable called gcl_settings. You can set the global variable name by including 'localization_variable' key in the constructor array.

The load_resource method generates HTML code and returns it as a string. This output can be used directly in your code, either by echoing it or by returning it within a shortcode.

You can also set, get, and remove data parameters like this:

Options

When creating a new instance of the UI class, you can pass an array of options to the constructor. Here are all the possible options:

Here's an example of how to use these options:

This will load the React application from the specified JavaScript file into an HTML container with the ID 'myApp' and the class 'myClass', and pass the specified data to a global JavaScript variable called 'myData'. The admin-ajax.php URL will not be included in the data.

Methods

The UI class provides the following methods:

Here's an example of how to use these methods:

This will load the React application from the specified JavaScript file into an HTML container with the ID 'myApp' and the class 'myClass', and pass the specified data to a global JavaScript variable called 'myData'. The admin-ajax.php URL will not be included in the data.

Method Chaining

The set_param method returns the UI object, enabling method chaining. Here's an example using the set_param method from the UI class:

In this example, each call to set_param returns the UI object itself, allowing another set_param call to be made on the same line. This is more concise and often more readable than making each call on a separate line. The final call to load_resource is made on a new line because it does not return the UI object and therefore cannot be chained.

This explanation should help users of your class understand how they can use method chaining to make their code more concise and readable.


All versions of wp_react_loader with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2.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 geekycodelab/wp_react_loader contains the following files

Loading the files please wait ....