This package is abandoned and no longer maintained. No replacement package was suggested.

Initialize a composer package based on a template package

Installs: 124

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 19

Forks: 0

Open Issues: 1


0.4.0 2015-11-28 09:15 UTC

This package is auto-updated.

Last update: 2020-01-21 10:48:08 UTC


Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version

Tired of creating the same directory structure every time you start a new project? Tired of constantly modifying files if you clone github template repo? This command line tool allows you to initialize a project based on a template, and fills in values in the template.


Install via composer

$ composer global require clippings/composer-init

This will install it to your user's global composer. If you already have ~/.composer/vendor/bin/ in your PATH you can start using it with

$ composer-init

otherwise you can do it by calling directly

$ ~/.composer/vendor/bin/composer-init

Basic Usage

  • composer-init search to discover templates
  • composer-init use {template-package} in an empty folder to use a template
  • composer-init token {token} set a github token for downloading past the github rate limit

composer-init Gets a lot of defaults from github repo & organization, so it is best to create an empty repo in github, clone it locally and run "composer-init use ..." there.

Creating Templates

A composer-init template must be published to, (therefore have a composer.json file) and have a prompts.json file to describe which of the available prompts will be used. The package should be published as "type": "composer-init-template". All the code for the template is present in the "root" directory.

example composer.json file:

    "name": "clippings/package-template",
    "description": "Package Template",
    "license": "MIT",
    "type": "composer-init-template",
    "authors": [
            "name": "John Smith",
            "email": "",
            "role": "Author"

example prompts.json file:


This states that this package will use these prompts, gather their input and then fill in the placeholders inside all the files in the root folder.

Here's an example template:


All prompts try to guess a reasonable default, but ask the user to confirm/correct its value.


The email of the author, by default uses git config You can set it yourself with git config {my email} or globally with git config --global {my email}. As stated in first time git setup guide

Adds {% author_email %} template variable


The name of the author, by default uses git config You can set it yourself with git config {my name} or globally with git config --global {my name}. As stated in first time git setup guide

Adds {% author_name %} template variable


The url for submitting new issues. By default gets the repo's gitub issues url. e.g.

Adds {% bugs %} template variable


Tries to guess the copyright holder by going through

  • github organization
  • github user
  • git user
  • file owner

And exposes it as "{year}, {copyright_entity}" - where year is the current year and copyright_entity is the guessed value. You can also get to the copyright_entity value separately

Adds {% copyright %} template variable
Adds {% copyright_entity %} template variable


The description of the github repo.

Adds {% description %} template variable


The github package name e.g. clippings/composer-init

Adds {% package_name %} template variable


Tires to guess the package name, using github's organization/username and repo name. So clippings/composer-init would be converted to Clippings\ComposerInit. It also tries to guess the name with initials, so in this case it would also give the option of CL\ComposerInit. These can be cycled with tab completion or auto-completed when entering

Adds {% php_namespace %}
Adds {% php_namespace_escaped %} template variable where all "\" characters are converted to "\\"


Get a "secure slack notification token". basically asks for a value and returns "slack:\n secure: {value}\n", so you can easily add slack to your .travis.yml notifications


The title of the github repo.

Adds {% title %} template variable


Inspired by grunt-init

Copyright (c) 2014-2015, Clippings Ltd. Developed by Ivan Kerin as part of

Under BSD-3-Clause license, read LICENSE file.