chenos / v8js-module-loader
Installs: 26 414
Dependents: 1
Suggesters: 0
Security: 0
Stars: 16
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- webmozart/path-util: ^2.3
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^6.5
README
Requirements
- PHP 7.0+
- V8Js extension 2.0+
Installation
composer require chenos/v8js-module-loader
Dependents
Testing
make test
Example
make example
Access http://127.0.0.1:8888
Usage
use Chenos\V8JsModuleLoader\ModuleLoader; // entry directory $loader = new ModuleLoader(__DIR__); $loader->setExtensions('.js', '.json'); $loader->setEntryDir(__DIR__); // array $loader->addOverride(['vue' => 'vue/dist/vue.runtime.common.js']); // key, value $loader->addOverride('vue', 'vue/dist/vue.runtime.common.js'); // v8js version > 2.1.0+ $loader->addOverride(['fn' => function (...$args) {}]); $loader->addOverride('obj', new stdClass()); $loader->addVendorDir(__DIR__.'/node_modules', __DIR__.'/bower_components'); $v8 = new V8Js(); $v8->setModuleNormaliser([$loader, 'normaliseIdentifier']); $v8->setModuleLoader([$loader, 'loadModule']);