This is a very simple set of snippets to automate your PHP Documentor tags [http://www.phpdoc.org/] while writing PHP classes using TextMate.
download: http://farmdev.com/downloads/PHPDoc.tar.gz
Here are the commands:
phpdoc_c : creates a PHPDoc class block phpdoc_d : creates a PHPDoc definition block (constant definition) phpdoc_f : creates a PHPDoc function block phpdoc_h : creates a PHPDoc header for the top of your script phpdoc_v : creates a PHPDoc class variable
** There is a very nice feature in TextMate that allows you to reference a cursor position in a snippet by simply repeating the numeric variable. What I like to do when writing functions is always comment the end of the function with its name so you know what the last trailing bracket is closing. This is fully automated for class and function blocks. As an example:
function do_something($input) { // lots of code ... // lots of code ... // lots of code ... // lots of code ... // lots of code ... // lots of code ... // lots of code ... // lots of code ... } // END function do_something($input)
I must also say that with TextMate 1.0.1 I am sold! Many thanks to the dev team and hopefully my license will help keep things moving. And feel free to include this in the default package if you see fit.
---
Here is a complete example of how a script would look using these snippets :
<?php
/** * Description of document * * @author Author Name * @version $Id$ * @copyright Author Name, 22 October, 2004 * @package default **/
/** * Define DocBlock **/
/** * undocumented class * * @package default * @author author **/ class Some_Class { /** * undocumented class variable * * @access public * @var string **/ var $some_var;
/** * undocumented function * * @access public * @return void * @param string $input * @author author **/ function do_something_cool($input) { } // END function do_something_cool($input) } // END class Some_Class
?>