dev-refactoring
dev-refactoringComposer package builder template
MIT
The Requires
by Roberts Gulans
dev-master
9999999-devComposer package builder template
MIT
The Requires
by Roberts Gulans
 Wallogit.com
                    
                    2017 © Pedro Peláez
                         Wallogit.com
                    
                    2017 © Pedro Peláez
                    
                    
                    
                    
                
                
            
Composer package builder template
This package provides template for creating packages., (*1)
Install this package globally to access from anywhere, (*2)
composer global require revati/packager=dev-master // Update path export PATH=~/.composer/vendor/bin:$PATH
Now you can call packager from your terminal., (*3)
First of all you have to initialize package. It will create ~/.Packager folder., (*4)
packager init
Out of the box packager does not come with any predefined templates. So you have to define them your self. To create template you have two options - generate from folder structure or fetch template config file (TODO: How to share generated template config files?)., (*5)
To create template config file from directory cd in in it and run, (*6)
packager template:make template-name
Now to use this template you can run, (*7)
packager new my-awesome-package template-name
It will initialize package in my-awesome-package directory., (*8)
See Simple example for more detailed info., (*9)
Those variables can be used with in files and in directory and file names. Currently are supported 6 variables:, (*10)
All variables are prefixed and suffixed with two underscores (that's why they are bold)., (*11)
template:share template-name command to upload template config file somewhere?Create new directory. With in it create new composer.json file., (*12)
{
  "name": "__author_name__/__package_name__",
  "description": "__package_description__",
  "authors": [
    {
      "name": "__author_name__",
      "email": "__author_email__"
    }
  ],
  "autoload": {
    "psr-4": {
      "__author_class__\\__package_class__\\": "src/"
    }
  },
}
Lets create src directory and with in __package_class__Class.php with fallowing content., (*13)
<?php namespace __author_class__\__package_class__;
class __package_class__Class extends SomeClass {
    // Code
}
Now when template is done lets make its configuration file., (*14)
packager template:make simple-template
Template is ready. To use it run, (*15)
packager new simple-package simple-template
It will create simple-package directory. It will contain composer.json file with fallowing content:, (*16)
{
  "name": "revati/simple-package",
  "description": "",
  "authors": [
    {
      "name": "revati",
      "email": "email@email.com"
    }
  ],
  "autoload": {
    "psr-4": {
      "Revati\\SimplePackage\\": "src/"
    }
  }
}
There also will be src folder with SimplePackageClass.php file. And its content will be:, (*17)
<?php namespace Revati\SimplePackage;
class SimplePackageClass extends SomeClass {
    // Code
}
Hope this example helps. In Variables section you can find all available variables., (*18)
Composer package builder template
MIT
Composer package builder template
MIT