There are lots of document generator out there , many of them quite good. Perhaps the best of them would be phpDocumentor version 2. Lets have a look why Sami is different from phpdocumentor.
Get Sami from Github (or integrate it as a dependency in your project Composer file
Sami uses Composer to manage its dependencies so just run the composer
$ composer.phar install ”
To confirm everything worked fine just execute the sami.php file.
$ php sami.php
Before generating documentation, you must create a configuration file.
<?php return new Sami\Sami('/path/to/symfony/src');
The first argument of constructor is the path to the code to generate documentation for. One valid method is to use PHP iterator (for that use the Symfony Finder class)
use Sami\Sami; use Symfony\Component\Finder\Finder; $iterator = Finder::create() ->files() ->name('*.php') ->exclude('Resources') ->exclude('Tests') ->in('/path/to/symfony/src') ; return new Sami($iterator);
The Sami constructor optionally takes an array of options as a second argument:
return new Sami($iterator, array( 'theme' => 'symfony', 'title' => 'Symfony2 API', 'build_dir' => __DIR__.'/build', 'cache_dir' => __DIR__.'/cache', 'default_opened_level' => 2, ));
<?php use Sami\Sami; use Sami\Version\GitVersionCollection; use Symfony\Component\Finder\Finder; $iterator = Finder::create() ->files() ->name('*.php') ->exclude('Resources') ->exclude('Tests') ->in($dir = '/path/to/symfony/src') ; // generate documentation for all v2.0.* tags, the 2.0 branch, and the master one $versions = GitVersionCollection::create($dir) ->addFromTags('v2.0.*') ->add('2.0', '2.0 branch') ->add('master', 'master branch') ; return new Sami($iterator, array( 'theme' => 'symfony', 'versions' => $versions, 'title' => 'Symfony2 API', 'build_dir' => __DIR__.'/../build/sf2/%version%', 'cache_dir' => __DIR__.'/../cache/sf2/%version%', 'default_opened_level' => 2, ));
Now that we have a configuration file, let’s generate the API documentation:
$ php sami.php update /path/to/config.php
The generated documentation can be found under the configured build/ directory (note that the client side search engine does not work on Chrome due to JavaScript execution restriction — it works fine in Firefox).
Sami also detects problems in your phpdoc and can tell you what you need to fix if you add the -v option:
$ php sami.php update /path/to/config.php -v
That’s all , enjoy the new gained knowledge.
The AI research landscape is currently one of the most dynamic and vibrant fields, showing no signs of slowing down…
In the dynamic landscape of technology, cloud computing emerges as the linchpin of innovation. Did you know the cloud computing…
Did you know thе sеcrеt bеhind Ubеr's ability to connеct drivеrs and ridеrs quickly and еfficiеntly? The answer is Michaеlangеlo!…
DevOps, the buzzword of yesteryears, is a concrete reality in forward-moving enterprises today. Organizations are actively adopting DevOps practices to…
Cloud computing and Artificial Intelligence (AI) are two fundamental pillars that are driving businesses forward in numerous ways beyond the…
Cloud computing has revolutionized the way businesses operate by providing a highly scalable, flexible, and cost-effective way to manage IT…