Documenting GlotPress with phpDocumentor

The current GlotPress API documentation (October 2021) was generated by ApiGen. Last commit was made on April 4th, 2016.

The last ApiGen commit was made on 23 Apr 2018, so I think this tool is deprecated. Furthermore, I was not able to use it with PHP 7.4 and GlotPress, so I look for another tool. The most PHP used tool is phpDocumentor. In this post I explain how to use it with GlotPress.

Install phpDocumentor globally on the machine, using the .phar tool.

cd ~/code/utils
mkdir phpDocumentor
cd phpDocumentor

Get the last .phar URL.

wget https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.1.2/phpDocumentor.phar

To run phpDocumentor, execute:

php phpDocumentor.phar run \ 
-d ~/code/wordpress/glotpress-env/glotpress.git \ 
-t ~/code/wordpress/glotpress-env/gp-docs \
--ignore "vendor/"

Where:

  • ~/code/wordpress/glotpress-env/glotpress.git is the GlotPress folder.
  • ~/code/wordpress/glotpress-env/gp-docs is the documentation folder.
  • vendor/ is the folder where Composer stores all the information. It is located in the root folder of the project.

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted

Ejecutando

composer update

en una máquina virtual Linux (Laravel Homestead), obtengo este error:

PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 64

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 64

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.