nikaia/php-node-bridge

Call your NodeJS scripts from Php

Maintainers

👁 nbourguig

Package info

github.com/nikaia/php-node-bridge

pkg:composer/nikaia/php-node-bridge

Statistics

Installs: 17

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.0.0 2022-11-16 10:40 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 1b5f9bb1ae5c1b3ea375f44c1cd9183f47faac86

  • Nassif Bourguig <nbourguig.woop@gmail.com>

Nikaiaphp-node-bridge

This package is not auto-updated.

Last update: 2026-06-26 02:27:35 UTC


README

👁 Latest Version on Packagist
[👁 Tests

Call your NodeJS scripts from Php

Installation

You can install the package via composer:

composer require nikaia/php-node-bridge

Usage

The bridge work by executing a node script that accept piped json arbitary data, and returns json response.

check tests/_fixtures/ok.script.js for a working example.

use Nikaia\NodeBridge\Bridge;

try {
 $response = Bridge::create()
 ->setNode('/usr/local/bin/node') // the path to the node (You can omit if in system path)
 ->setScript('/path/to/your/script.js') // the path to your script 
 ->pipe(['foo' => 'bar']) // the data to pipe to the script
 ->run();
}
catch (BridgeException $e) {
 echo $e->getMessage();
}

var_dump($response->json()); // ['foo' => 'bar']
var_dump($response->output()); // the raw output of the script {"foo":"bar"}


Changelog

Please see CHANGELOG for more information on what has changed recently.

Releases

This package use semver releases. Releases are managed using standard-version node package, and requires adhering to conventionalcommit commit styles.

  1. Implement a feature or a fix etc.
  2. Use commit message like fix: Fix an issue or feat: Implement a feature ...
  3. Or rewrite the commit message while squashing/closing the PR!!
  4. Update your local project, checkout main branch
  5. Run : composer release to generate changelog, and to tag to new release.
  6. Check everything is okay.
  7. Push the tag using git push --follow-tags origin main

This repository is using Semantic Pull Request bot to enforce conventional commit message and PR titles

Credits

License

The MIT License (MIT). Please see License File for more information.