Skip to content

trybeans/beans-woocommerce

Repository files navigation

Beans for WooCommerce

🔨 Prerequisite

  • You need to make sure that you have mysql installed and that mysql is available in your path. To check that you can run which 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

⏯ Develop

  1. Create a local tunnel for localhost on port 8800 using ngrok.io
ngrok http 8800
  1. Copy .env.testing to .env.local and update env vars.

  2. If needed reset any existing testing configuration

./composer test-reset
  1. Launch the web server
./composer run-script start

Visit the address given by the localtunnel Wordpress admin username and password are beans

🧽 Linting

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/

🧪 Testing

to be completed...

🐞 Debugging

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

📕 Documentation

Useful links