If you have Windows, and are running WAMP, this is the step by step installation guide to getting phpDocumentor to work. This write-up assumes that you have WAMP installed and working.
- Download Composer from https://getcomposer.org/
- Run through the installation with the default settings. It will locate php for you automatically. If you're having any issues with the install, Google the response. There shouldn't be any errors though.
- If you have CMD opened, close it now.
- Open CMD and type in composer. If something starts happening, Composer is installed correctly.
- Go to the directory that you want to install phpDocumentor.
- In your project directory, create a JSON file. Name it, composer.json and add the following code to it
{ "require-dev": { "phpdocumentor/phpdocumentor": "2.*" } }
- For example, let's say that your project directory is located in C:/wamp/www/your_project, you're going to want to open CMD and make sure that you've navigated to that directory. Remember cd ../ to move up a directory. If you're in C:/ then type in cd C:/wamp/www/your_project to get into that directory.
- Now type composer install
- This will take some time (usually less than a couple of minutes) but will install a new directory called vendor
- In CMD, type in cd vendor/bin. You're going to be in C:\wamp\www\your_project\vendor\bin
- Now you can type in phpdoc followed by a command
- If you want to create documentation for a single file, you'll use -f. If you want to create documentation for the entire directory, you'll use -d.
- You're going to want to follow it with a -t that states where the documentation will be going. Create a docs folder in C:\wamp\www\your_project\docs.
- The last segment that you have a choice of appending is --template. Go to https://www.phpdoc.org/templates to get the available templates. i.e. clean
- For example, to create documentation for a file go to CMD and in the bin directory, type phpdoc -f "C:\wamp\www\your_project\classes\some_class.php" -t "C:\wamp\www\your_project\docs" --template "responsive-twig"
- To create documentation for the entire directory, type in the following: phpdoc -d "C:\wamp\www\your_project\classes" -t "C:\wamp\www\your_project\docs" --template "responsive-twig"
Thanks For sharing such a knowledgable post.
ReplyDeleteC++ Course In Delhi
C++ Course In Gurgaon
C++ Course In Noida
This is an excellent post and was able to complete the install with no issues, great stuff !
ReplyDelete