No matter PHP or nodejs, you should create a project first. The project definition file provides dependency information, and help you to install required packages by package management tools. Here are examples of project definition file with minimal settings, you may use it as a quick start. You can modify the file to fit your project later.
file name: composer.json
{
"name": "zordius/HandlebarsCookbook",
"description": "A cookbook of handlebars and mustache, focus on handlebars.js , mustache.js and lightncandy usage",
"homepage": "https://github.com/zordius/HandlebarsCookbook",
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"zordius/lightncandy": "1.2.6"
}
}
file name: package.json
{
"name": "handlebars.cookbook",
"version": "0.0.1",
"description": "A cookbook of handlebars and mustache, focus on handlebars.js , mustache.js and lightncandy usage",
"repository": {
"type": "git",
"url": "git+https://github.com/zordius/HandlebarsCookbook.git"
},
"homepage": "https://github.com/zordius/HandlebarsCookbook",
"devDependencies": {
"handlebars": "4.7.7",
"mustache": "4.2.0"
}
}
composer install
npm install
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
var Handlebars = require('handlebars');
var Mustache = require('mustache');
Now the library is ready to go!