WTool shed

This tool shed is basically an overview of commands of different command line tools I use while developing web sites. Basically a quick lookup sheet of how to git, how to ZF tool, how to composer. For tutorials you can use the links I collected in my Link Shed. Some notes on how to set up a web development environment on a Mac can be found in the Dev Shed.

Since I do all my coputer related stuff on a Mac (its Unix-like uder the hood, what more do I need to say), all this is Unix related!

I work on multiple projects which use the same tools. To keep things nicely organised I install the tools somewhere outside the project folders. '/usr/local' is the folder where I keep them. I then setup aliasses to the tools to keep the commands short.


// make <directory> a git repository
git init <directory>

// create a bare git repository (e.g. you could do this in your Dropbox/Git folder)
git init --bare <repo>.git

// add an origin remote on dropbox
git remote add origin /$Home/Dropbox/Git/<repo>.git

// add an origin remote on bitbucket (create a repository first on your bitbucket account)
git remote add origin https://<user>@bitbucket.org/<user>/<repo>.git

// push the local repository to remote
git push -u origin --all
git push -u origin --tags

// show all repositories and their locations
git remote -v

// clone a repository
git clone https://<user>@bitbucket.org/<user>/<project>.git <destination>

// stop tracking a file
git rm --cached

// list all tracked files
git ls-files

// show what happened
git log

// create a branch
git checkout -b <branchName>

// push a branch to remote
git push -u origin <branchName>

// remove a local branch
git branch -d <branchName>
// and remove it from remote
git push origin :<branchName>

ZF tool

My alias for zf tool is 'zf=php /usr/local/vendor/bin/zf.php' (where php is installed in '/usr/bin' which is in my path). Did you notice the vendor part in the path to zf? That is because I used composer to install it.

// remember zf stands for 'php /usr/local/vendor/bin/zf.php'
// show zend framework version

zf version

// create module test
zf create module Test

// create IndexController in module Test
zf create controller Index Test

// create action delete in IndexController in module Test
zf create action delete index Test

// show zend framework version
zf version

// show zend framework version
zf version

// show zend framework version
zf version

My alias for composer is 'composer=php /usr/local/composer.phar'. Composer expects a file 'composer.json' in the current folder which it uses to determine what to do. If there is something to install it will do so in the folder 'vendor'. (I used this to install zftool in '/usr/local'.)


// example of composer.json file to install zftool
{ "require-dev": {"zendframework/zftool": "dev-master"}}

// install project dependencies
composer install

// update project dependencies
composer update