helloworld
This is a sandbox repo, (*1)
Stuff tested out with this repo:
- Git
- Github
- Multiple SSH Keys
- Composer
- PHPUnit
- Packagist
- Travis-ci
- Webhooks, (*2)
Badges:, (*3)
, (*4)
HOWTOs
Initial setup
- Usual prerequisites installed
- cd htdocs && mkdir helloworld && cd helloworld
Composer
jeng@macbook:/Applications/MAMP/htdocs/helloworld $ composer init
Welcome to the Composer config generator
This command will guide you through creating your composer.json config.
Package name (<vendor>/<name>) [engelju/helloworld]:
You can accept the default or customize it like "yourname/hello" or what you want. Complete all Composer questions like:, (*5)
Package name (<vendor>/<name>) [engelju/helloworld]: engelju/helloworld
Description []: A test packages for composer and github
Author [Junior Grossi <me@juniorgrossi.com>]: Julie Engel <julie.engel@mail.com>
Minimum Stability []: dev
Define your dependencies., (*6)
Would you like to define your dependencies (require) interactively [yes]? no
Would you like to define your dev dependencies (require-dev) interactively [yes]? no
{
"name": "engelju/composer_github",
"description": "A test packages for composer and github",
"authors": [
{
"name": "Julie Engel",
"email": "julie.engel@mail.com"
}
],
"minimum-stability": "dev",
"require": {
}
}
Do you confirm generation [yes]? yes
Then we have to make a few changes to your generated composer.json so that it will look like this:, (*7)
{
"name": "engelju/composer_github",
"description": "A test packages for composer and github",
"authors": [
{
"name": "Julie Engel",
"email": "julie.engel@mail.com"
}
],
"license": "GPL",
"autoload": {
"psr-0": {
"HelloWorld": "src/"
}
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8@dev"
},
"minimum-stability": "dev"
}
What we did here is add information about PHP 5.3 as minimum requirements (require section), as well as require phpunit in the dev section, and tell Composer to "autoload" (using PSR-0) all files with "HelloWorld" namespace that are inside "src" dir., (*8)
Then you can do a composer install and it will create a vendor-directory and install the components there., (*9)
File Structure / Code
$ tree -L 3
.
โโโ .gitignore --> git ignore file
โโโ .travis.yml --> travis-ci config file
โโโ LICENSE --> first version auto-generated by github
โโโ README.md --> first version auto-generated by github
โโโ composer.json --> composer config file
โโโ composer.lock --> locks the current versions of the dependencies
โโโ src/ --> directory where the actual code lies
โย ย โโโ HelloWorld/ --> yay, namespacing
โย ย โโโ SayHello.php --> actual class
โโโ tests/ --> directory where our tests lie
โย ย โโโ HelloWorld/ --> mirroring the code dir sturcture
โย ย โย ย โโโ SayHelloTest.php --> one test for each class
โย ย โโโ bootstrap.php --> phpunit bootstrap
โย ย โโโ phpunit.xml --> phpunit config file
โโโ vendor/ --> dependencies, installed with `composer install`
โโโ autoload.php
โโโ bin/
โย ย โโโ phpunit -> ../phpunit/phpunit/phpunit
โโโ composer/
โโโ doctrine/
โโโ phpdocumentor/
โโโ phpspec/
โโโ phpunit/
โโโ sebastian/
โโโ symfony/
PHPUnit / Testing
Packagist
Git
- Branches
- Committing
- Remotes
Multiple SSH Keys
Helpful docs:
- https://help.github.com/articles/generating-ssh-keys/
- http://serverfault.com/questions/221760/multiple-public-keys-for-one-user
- https://gist.github.com/jexchan/2351996
- http://www.robotgoblin.co.uk/blog/2012/07/24/managing-multiple-ssh-keys/, (*10)
Github
- Issues
- Pull Requests
- Working on your own stuff
- Contributing on other projects
Webhooks
Travis-CI