- You need to make sure that you have php installed and that
php
is available in your path. To check that you can runwhich php
To install php 8.0 on macos, you can use homebrew:
brew install shivammathur/php/php@8.0
To install php 8.0 on ubuntu, you can use the following command:
sudo apt install php8.0
-
You need to make sure that you have mysql installed and that
mysql
is available in your path. To check that you can runwhich mysql
-
If you don't have composer, you will need to install it:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --filename=composer
php -r "unlink('composer-setup.php');"
- Install all dependencies using composer:
./composer install
- Create a local tunnel for localhost on port 8800 using ngrok.io
ngrok http 8800
-
Copy
.env.testing
to .env.local
and update env vars. -
If needed reset any existing testing configuration
./composer test-reset
- Launch the web server
./composer run-script start
Visit the address given by the localtunnel
Wordpress admin username and password are beans
To run all linters:
./composer run-script lint
To only run phpcs,
./vendor/bin/phpcs
To only run phpstan,
./vendor/bin/phpstan analyze --memory-limit=200M
To reformat the code:
./vendor/bin/phpcbf
Ensure that your code is well documented:
https://stackoverflow.com/questions/1310050/php-function-comments https://www.phpdoc.org/ https://phpdocu.sourceforge.net/howto.php https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.param.pkg.html https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/
to be completed...
Install Xdebug to debug your php code. Follow the wizard step here: https://xdebug.org/wizard
To get PHPInfo:
php -f scripts/phpinfo.php > phpinfo.txt
Open phpinfo.txt
to read the output.
To create pot file:
./vendor/bin/wp i18n make-pot src src/i18n/beans-woocommerce.pot --exclude=src
To create mo file:
./vendor/bin/wp i18n make-mo src/i18n
Translated strings can be downloaded from WordPress Translation platform
- WooCommerce minimum requirements by version
- WooCommerce versions
- WooCommerce REST API
- WordPress minimum requirements by version
- PHP supported versions
Useful links
- Debugging WP 404: https://gist.github.com/yunusga/33cf0ba9e311e12df4046722e93d4123