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

generator-composer

v3.0.1

Published

A generator for Yeoman that provides a boilerplate for a PHP Composer project

Downloads

62

Readme

generator-composer

NPM version Dependency Status devDependency Status Build Status Percentage of issues still open

About

A generator for Yeoman.

It provides a basic boilerplate for a Composer project, which features:

The proposed Grunt build for the generated Composer project has the following tasks:

  • PHPLint to review quality of code
  • PHPUnit to run tests
  • automatic creation of a PhpDocumentor documentation
  • Usage of Php Copy/Paste Detector
  • Automatic versioning of all the project when version is modified in package.json

The generated PHP project does not rely on any other PHP dependency than Composer and Packagist-installed packages (e.g. no PEAR dependency).

Installation

You must have Nodejs and NPM installed.

Then, to install Yeoman globally from npm, run:

npm install -g yo

Finally, to install generator-composer globally from npm, run:

npm install -g generator-composer

You may also just install it locally:

npm install generator-composer

Usage of the generator

Once you have installed Node, NPM, Yeoman and the generator itself, you can initiate the generator:

yo composer

Yeoman will ask you 3 questions:

  1. your github account (e.g. gitAccount)
  2. the name of the repository on Github (e.g. php-my-super-package)
  3. the name of the main PHP class of your project (e.g. mySuperPackage)

Build dependencies of your generated PHP project

In order to build your generated Composer project from its source, you will need Grunt and PHP on the command line.

So, you must install PHP5 on your system on your command line. Test it:

php --help

To install Grunt globally on the command line (and run the above build task), run:

npm install -g grunt-cli

Then, with Grunt, you can install Composer locally. Just run once:

grunt init

Then, you can install PhpDocumentor, PhpUnit and PhpCPD locally. Just run once:

php composer.phar install -v

Finally, you should also install the PHP extension named Xdebug, which will be used by PhpUnit for code coverage.

Build the sources of your generated PHP project

Once all your dependencies are installed, you can build your project with Grunt:

grunt build

The build process will run the following tasks:

  • PhpLint: runs php -l over the "src" folder
  • Runs the tests located in the "tests" folder with PHPUnit
  • Generates a PhpDocumentor documentation in the "doc" folder from the files of the "src" folder
  • Detects copy/paste of code in the files of the "src" folder with PhpCPD

Publish your generated project on Packagist

The generated PHP is ready-to-publish on Packagist. Just login on Packagist with Github, add the Packagist hooks to your Github account, and activate your package on Packagist.

Build the generator from its sources

The generator itself can be built from its sources. At the moment, the build process only includes syntax checks with JSHint and JSCS.

In order to build the generator from its source, you will need Grunt. To install Grunt globally on the command line (and run the above build task), run:

npm install -g grunt-cli

Just run the grunt task in the folder where your generator is installed:

grunt

Dev dependencies Status Built with Grunt

Todos

  • Try to get a livereload process for the generated project (maybe with grunt-php)
  • More comments in the code
  • Include a changelog generator in the build process of the generated code

Credits

License

This generator is released under the MIT License.

Analytics