使用gitonomy gitlib库创建补丁

I am using Gitonomy libray Git lib to manipulate Git repository through php. I am to create patch file from a repository and there is no function for creating, reverting and applying patch files. There is a function named 'run' that can run git commands directly but they are ended up in exceptions. May be I am passing wrong arguments to the function. Can any one help me out in creating a patch files through Gitonomy Git lib Library. Following is the link of the library.

https://github.com/gitonomy/gitlib

Thanks and Regards, Furqan Ahmed.

I mentioned in the comments as examples of how to use run:

The OP Furqan Ahmed adds

The path of the patch file that I am giving as an argument should be replaced with 'origin/master' and it will return the patch as a string and then we have to create a file with the content and save to a location.

git format-patch -3 HEAD --stdout > patches/third.patch 
$repository = new Repository("/vagrant/project/devrepo/remote"); 
$repository->run('format-patch', array('-3', 'HEAD', '--stdout', 'origin/master/project/patches/fix_empty_poster.patch'));