11# Beans for WooCommerce
22
3- ### Prerequisite
3+ ## 🔨 Prerequisite
44
5- - You need to make sure that you have mysql installed and that ` mysql ` is available in your path
5+ - You need to make sure that you have mysql installed and that ` mysql ` is available in your path.
66To check that you can run ` which mysql `
77
8-
9- ### 1. Install Composer
10-
8+ - If you don't have [ composer] ( https://getcomposer.org/doc/00-intro.md ) , you will need to install it:
9+
1110``` shell script
1211php -r " copy('https://getcomposer.org/installer', 'composer-setup.php');"
1312php composer-setup.php --filename=composer
1413php -r " unlink('composer-setup.php');"
1514```
16- If you are having trouble to find out more about it here: https://getcomposer.org/doc/00-intro.md
1715
18- ### 2. Install dependencies
16+ - Install all dependencies using composer:
1917
2018``` shell script
2119./composer install
2220```
2321
24- ### 3. Running Linters
22+ ## ⏯ Develop
23+
24+ 1 . Create a local tunnel for localhost on port 8800 using ngrok.io
25+ ``` shell script
26+ ngrok http 8800
27+ ```
28+
29+ 2 . Copy ` .env.testing ` to .` env.local ` and update env vars.
30+
31+
32+ 3 . If needed reset any existing testing configuration
33+ ``` shell script
34+ ./composer test-reset
35+ ```
36+
37+ 4 . Launch the web server
38+ ``` shell script
39+ ./composer run-script start
40+ ```
41+
42+ Visit the address given by the localtunnel
43+ Wordpress admin username and password are ` beans `
44+
45+ ## 🧽 Linting
46+
2547To run all linters:
2648``` shell script
27- ./composer run-script lint
49+ ./composer run-script lint
2850```
2951
3052To only run phpcs,
@@ -36,24 +58,62 @@ To only run phpcs,
3658To only run phpstan,
3759
3860``` shell script
39- ./vendor/bin/phpstan analyze --memory-limit=100
61+ ./vendor/bin/phpstan analyze --memory-limit=200M
4062```
4163
4264To reformat the code:
4365``` shell script
4466./vendor/bin/phpcbf
4567```
4668
69+ Ensure that your code is well documented:
4770
48- ### 4. Develop
71+ https://stackoverflow.com/questions/1310050/php-function-comments
72+ https://www.phpdoc.org/
73+ https://phpdocu.sourceforge.net/howto.php
74+ https://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.param.pkg.html
75+ https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/
4976
50- ``` shell script
51- ./composer run-script start
77+ ## 🧪 Testing
78+
79+ to be completed...
80+
81+ ## 🐞 Debugging
82+
83+ Install [ Xdebug] ( https://xdebug.org/ ) to debug your php code.
84+ Follow the wizard step here: https://xdebug.org/wizard
85+
86+ To get PHPInfo:
87+
88+ ``` bash
89+ php -f scripts/phpinfo.php > phpinfo.txt
5290```
53-
54- Wordpress admin username and password are ` beans `
5591
56-
57- ### 5. Testing
92+ Open ` phpinfo.txt ` to read the output.
93+
94+
95+ To create pot file:
96+ ``` bash
97+ ./vendor/bin/wp i18n make-pot src src/i18n/beans-woocommerce.pot --exclude=src
98+ ```
99+
100+ To create mo file:
101+ ``` bash
102+ ./vendor/bin/wp i18n make-mo src/i18n
103+ ```
104+
105+ Translated strings can be downloaded from [ WordPress Translation platform] ( https://translate.wordpress.org/projects/wp-plugins/beans-woocommerce-loyalty-rewards/ )
106+
107+
108+ ## 📕 Documentation
109+
110+ - [ WooCommerce minimum requirements by version] ( https://woocommerce.com/document/update-php-wordpress/ )
111+ - [ WooCommerce versions] ( https://developer.woocommerce.com/releases/ )
112+ - [ WooCommerce REST API] ( https://woocommerce.com/document/woocommerce-rest-api/ )
113+ - [ WordPress minimum requirements by version] ( https://make.wordpress.org/core/handbook/references/php-compatibility-and-wordpress-versions/ )
114+ - [ PHP supported versions] ( https://www.php.net/supported-versions.php )
115+
58116
117+ Useful links
118+ - Debugging WP 404: https://gist.github.com/yunusga/33cf0ba9e311e12df4046722e93d4123
59119
0 commit comments