diff --git a/README.md b/README.md index a98f2fd..6a91065 100644 --- a/README.md +++ b/README.md @@ -122,5 +122,12 @@ EOT; ``` - Note: `app.bundle.js` is client javascript code. The page is rendered fully even {$markup} is removed by client JS code. + +### VoidV8Module + +It is possible to install `VoidV8Module` to run non V8Js environment for clien side rendering only. + +```php +$this->install(new FakeV8Module(new ReduxModule($distDir, 'ssr_hello'))); +``` diff --git a/composer.json b/composer.json index d42ec64..245fde7 100644 --- a/composer.json +++ b/composer.json @@ -2,9 +2,9 @@ "name": "bear/reactjs-module", "description": "Redux React Serevr-Side Rendering using V8Js module for BEAR.Sunday", "require": { - "php": ">=7.0.0", - "bear/resource": "^1.2", - "koriym/redux-react-ssr": "^1.0.1" + "php": ">=7.1.0", + "bear/resource": "^1.4.0", + "koriym/redux-react-ssr": "^1.0.2" }, "require-dev": { "phpunit/phpunit": "^5.3" diff --git a/src/VoidV8Module.php b/src/VoidV8Module.php new file mode 100644 index 0000000..78895d2 --- /dev/null +++ b/src/VoidV8Module.php @@ -0,0 +1,26 @@ +bind(\V8Js::class)->to(VoidV8Js::class); + } +} diff --git a/tests/Fake/FakeReduxRo.html.php b/tests/Fake/FakeReduxRo.html.php index 33537a9..b4ce95e 100644 --- a/tests/Fake/FakeReduxRo.html.php +++ b/tests/Fake/FakeReduxRo.html.php @@ -16,7 +16,7 @@ -
{$view->markup}>
+
{$view->markup}
diff --git a/tests/ReduxRendererTest.php b/tests/ReduxRendererTest.php index d1385c3..285d6c8 100644 --- a/tests/ReduxRendererTest.php +++ b/tests/ReduxRendererTest.php @@ -34,7 +34,7 @@ public function testRender() -

konichiwa

>
+

konichiwa

diff --git a/tests/VoidV8ModuleTest.php b/tests/VoidV8ModuleTest.php new file mode 100644 index 0000000..0a7e305 --- /dev/null +++ b/tests/VoidV8ModuleTest.php @@ -0,0 +1,17 @@ +getInstance(FakeReduxRo::class); + $body = (string) $ro; + $this->assertContains('
', $body); + } +}