Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good way to document controller actions in PHPDoc?

I'm trying to figure out a good way to document controller actions in a php mvc framework. It's really important to me that there is a way to stick the url for the action in there, my problem is that I cant seem to find a way to fit that into the schema for phpdoc.

like image 383
herbert.fitzgerald Avatar asked Aug 17 '12 13:08

herbert.fitzgerald


People also ask

What is a PHPDoc comment?

*/ These PHPDoc formatted comments are translated into HTML, creating documentation that explains what each class, function, or variable does without people having to read through the entire code.

What are the command-line options In phpDocumentor?

When running phpDocumentor there are three command-line options that are essential: specifies the directory, or directories, of your project that you want to document. specifies a specific file, or files, in your project that you want to document. specifies the location where your documentation will be written (also called 'target folder').

How to generate documentation with phpDocumentor?

After you have Installation phpDocumentor you can use the phpdoc command to generate your documentation. Throughout this documentation we expect that the phpdoc command is available; thus whenever we ask you to run a command, it will be in the following form

How to add options in PHPDoc without arguments?

All you need to do is add a file called 'phpdoc.dist.xml' to the root of your project, add your options to it and then invoke the phpdoc command without arguments.


1 Answers

I don't really understand your problem/question. You can put whatever you want to in a phpdoc block, including the relevant URL for a controller action (you can even use markup if you want):

/**
 * This is some foo action.
 *
 * URL: /foo/bar/baz
 */
public function fooAction(/* ... */) {
    // ...
}

That said, if you specifically want to use a custom tag like @url or something, then you just need to use the -ct command-line option to tell phpdoc that you don't want it throwing parse errors when it comes across your custom tag(s):

# Will specify custom tag @url
phpdoc -ct url ...
like image 92
FtDRbwLXw6 Avatar answered Oct 15 '22 08:10

FtDRbwLXw6