PHP code example of abhishek6262 / nodephp

1. Go to this page and download the library: Download abhishek6262/nodephp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abhishek6262 / nodephp example snippets




// $environment = new \abhishek6262\NodePHP\System\Environment('projectRootPath', 'binDirectoryPath');
$environment = new \abhishek6262\NodePHP\System\Environment(__DIR__);

$npm = new \abhishek6262\NodePHP\NPM($environment);

if (! $npm->exists()) {
    $npm->install();
}

if ($npm->packagesExists() && ! $npm->packagesInstalled()) {
    $response = $npm->installPackages();
    
    if ($response->statusCode() == '0') {
        echo "Packages successfully installed.";
    } else {
        echo "Failed to install the packages.";
    }
    
    print_r($response->output());
}