3.8.3 • Published 10 months ago
dotphp v3.8.3
DotPHP
Require PHP files from Node.js with Uniter.
Installing
npm install --save dotphp
Hooking Uniter into require(...)
You can install a custom require(...)
extension that will use Uniter to compile the specified PHP file to JS and include it.
Example:
PHP file my_module.php
:
<?php
print 'Hello from my_module!';
JS file my_entrypoint.js
:
// Register the extension for requiring .php files
require('dotphp/register')().then(() => {
require('./my_module.php')().execute();
});
Requiring PHP files without hooking require(...)
You can also require PHP files without interfering with require(...)
behaviour by using the <DotPHP>.require(...)
method.
Example:
PHP file my_module.php
:
<?php
print 'Hello from my_module!';
JS file my_entrypoint.js
:
require('dotphp').require('./my_module.php')().execute();
Keeping up to date
- Follow me on Twitter for updates: https://twitter.com/@asmblah
3.8.3
10 months ago
3.8.1
2 years ago
3.8.0
2 years ago
3.7.1
4 years ago
3.7.0
5 years ago
3.6.1
5 years ago
3.6.0
5 years ago
3.5.2
6 years ago
3.5.1
6 years ago
3.5.0
6 years ago
3.4.0
6 years ago
3.3.0
7 years ago
3.2.0
7 years ago
3.1.0
7 years ago
3.0.0
7 years ago
2.0.0
8 years ago
1.1.1
9 years ago
1.1.0
9 years ago
1.0.0
9 years ago