GitHub - sbvictory/hypernova-php: PHP client for rendering your React components via Hypernova. · GitHub
Skip to content
 
 

Latest commit

 

History

89 Commits

Folders and files

Repository files navigation

Hypernova-PHP Build Status codecov

PHP client for your Hypernova service.

Getting Started

composer require wayfair/hypernova-php

Make a Renderer:

use \WF\Hypernova\Renderer;

$renderer = new Renderer('http://localhost:3030/batch');

Give it some work:

$renderer->addJob('myViewId', ['name' => 'my_module_name', 'data' => ['some' => ['props']]);

Optionally add a plugin or two (see plugin section):

$renderer->addPlugin($myPlugin);
$renderer->addPlugin($myOtherPlugin);

Then go get your rendered Response:

$response = $renderer->render();

Plugin API

This is how you customize client behavior. Common usecases include:

  • Logging request metadata like performance timings
  • Error logging
  • Injecting/removing props
  • Inlining stack traces in development environments
  • Stopping requests to the service entirely, letting everything fall back to client rendering

Generally, you will want to implement some subset of the lifecycle hooks; maybe you want onError handling but have no need for shouldSendRequest. For developer convenience, you may extend \WF\Hypernova\Plugin\BasePlugin which provides no-op implementations of all of the hooks.

TODO: write up API docs. Reference https://github.com/airbnb/hypernova-node#plugin-lifecycle-api

Contributing:

Fork it, submit a PR.

Run tests:

composer test

About

PHP client for rendering your React components via Hypernova.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages