Search code examples
phpbashgruntjsphplint

What is the command to install phplint for grunt from the bash shell?


I'm use to using something like

npm install grunt-contrib-jshint --save-dev

for the install.

However this did not work:

npm install grunt-contrib-phplint --save-dev

I found these sites here:

https://www.npmjs.com/package/phplint

https://github.com/jgable/grunt-phplint

but it does not look like it matches with the rest of my code. I need to install it and modify the Gruntfile.js of course.

// you must load each module
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// grunt.loadNpmTasks("grunt-phplint"); // from links

Solution

  • The odd thing is, is that this particular package does not use the contrib- prefix.

    Simply use for the install:

    npm install grunt-phplint --save-dev;
    

    and this to load the task:

    grunt.loadNpmTasks("grunt-phplint");
    

    and finally this to run the task:

    phplint: {
        good: [your_php_dir + "*.php"]
    },