/*gulpfile.js*/
//https://www.npmjs.com/package/@cedx/gulp-php-minify
const {phpMinify} = require('@cedx/gulp-php-minify');
const {TransformMode} = require('@cedx/gulp-php-minify');
const gulp = require('gulp');
gulp.task('minify:php', () => gulp.src('path/to/lib/**/*.php', {read: false})
.pipe(phpMinify({
//can provide the path to the php executable
binary: 'C:\\Program Files\\PHP\\php.exe',
//=safe: very reliable, but it very slow
//=fast: not very reliable, but very fast. require: php7.0 or later
mode: TransformMode.fast,
silent: true //disable output
}))
.pipe(gulp.dest('path/to/out'))
);
/*
HOW:
# run task
gulp minify:php
*/