npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-phplint

v0.1.0

Published

A Grunt 4.0 task for running phplint on your php files

Downloads

1,413

Readme

grunt-phplint

A Grunt task for linting your php. A simple wrapper around the php -l <filename> command.

Example Gruntfile

var cfg = {
	phplint: {
		good: ["test/rsrc/*-good.php"],
		bad: ["test/rsrc/*-fail.php"]
	}
};

grunt.initConfig(cfg);

grunt.loadNpmTasks("grunt-phplint");

grunt.loadTasks("./tasks");

grunt.registerTask("default", ["phplint:good"]);

Options

By default we assume that the php command is in your path, if not, you can specify the full path to php like the example below. You can also pass additional flags, like '-lf'.

To pass parameters to an argument:

var cfg = {
	phplint: {
		options: {
			phpArgs: {
				"-d": null,
				"-f": null,
				"-c": "/usr/local/my-debug-config.ini"
			}
		},
		good: ["test/rsrc/*-good.php"],
		bad: ["test/rsrc/*-fail.php"]
	}
};

To pass multiple parameters to the -d argument:

var cfg = {
	phplint: {
		options: {
			phpArgs: {
				"-d": null,
				"-f": null,
				"-d": ["display_errors", "display_startup_errors"]
			}
		},
		good: ["test/rsrc/*-good.php"],
		bad: ["test/rsrc/*-fail.php"]
	}
};

Passing in your own special configuration file or using -n to remove configuration files can be helpful when the lint fails but no errors are output to the stdout. If you need to log these errors, consider a plugin like grunt-log to facilitate this.

Lastly, if you want to limit the number of files we process at a time, set the spawnLimit.

var cfg = {
	phplint: {
		options: {
			phpCmd: "/usr/bin/php", // Or "c:\EasyPHP-5.3.8.1\PHP.exe".
			spawnLimit: 10
		},

		good: ["test/rsrc/*-good.php"],
		bad: ["test/rsrc/*-fail.php"]
	}
};

Caching

As of version 0.0.3, we cache previously hinted files to improve performance. This is done by taking a hash of the contents of a file and checking it against previously successful linted files content hashes.

By default, we will use the os.tmpdir() as the location for holding our swapped files (the files are empty, just placeholders). To change this you can pass in a swapPath option:

var cfg = {
	phplint: {
		options: {
			swapPath: "/some/crazy/path/to/temp/dir"
		},

		good: ["test/rsrc/*-good.php"],
		bad: ["test/rsrc/*-fail.php"]
	}
};

License

Licensed under the MIT License, Copyright 2013 Jacob Gable