How to create yii2 extension and push to github and register into packagist to allow end user install from composer
yii2, How to, Extension, Github, Packagist, Composer, hzl, scotthuangzl , google
**1. Create Extension in yii2.**
As for this step, you can refer to [Create Extension](https://github.com/yiisoft/yii2/blob/master/docs/guide/structure-extensions.md "create extension")
In short, you can use gii to create extension after read above article. Just be care to change the output as
change the namespace as
[...]You can link your github account now.
$ git config --global user.name "Your Name"
$ git config --global user.email "firstname.lastname@example.org"
And then add files.
git add <file1>
git add <file2>
git commit -m "your comment"
$ ssh-keygen -t rsa -C "email@example.com"
You will find .ssh dir in you home dir, and find id_rsa和id_rsa.pub
You can tell id-rsa.pub to everyone.
$ git remote add origin firstname.lastname@example.org:youraccount/yourrepository.git
$ git push -u origin master
t will need input your github account and pass since use -u
In future, you only need below
$ git push origin master
**4. Register your github repository into packagist**
Don't forget register your github repository into packagist, end user can install your widget only after you complete register.
And packagist will give you hint for how to setup service in github to auto synchronize every commit from github to packagist.