- PC Setup
- Git Set Up
- WordPress Coding Standard
- WordPress Plugin Development
- WordPress Theme Development
- WordPress Rest API Development
- Unit Testing
- React Tutorials
- GrumPHP
- IDE will be PHPStorm
- Import IDE Settings. Please visit the below link to import IDE settings.
- How to import IDE Settings
- Node.js LTS version, XAMPP or MAMP, Git
- If you're using macOS then install brew
- Create an account to atlassian for task management by JIRA software.
- Connect with official slack channel for communication with team.
Then connect your git account with the current PC through SSH Key
. Read this article to connect with your PC.
Adding a new SSH key to your GitHub account.
https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/
FOR SWITCHING ACCOUNT
Delete current ssk key
ssh-add -D
setup new ssh key
ssh-add ~/.ssh/id_azizulhasan
Change username and email
Git config user.name “username”
Git config user.email “[email protected]”
Gitflow is an alternative Git branching model that involves the use of feature branches and multiple primary branches.
WordPress Coding Standards by WordPress must read documentation for coding standard.
Coding standards help avoid common coding errors, improve the readability of code, and simplify modification. They ensure that files within the project appear as if they were created by a single person.
Following the standards means anyone will be able to understand a section of code and modify it, if needed, without regard to when it was written or by whom.
If you are planning to contribute to WordPress Core, you need to familiarize yourself with these standards, as any code you submit will need to comply with them.
- CSS Coding Standards
- HTML Coding Standards
- JavaScript Coding Standards
- PHP Coding Standards
WordPress Coding Standards for PHP_CodeSniffer
The best resource for learning about WordPress plugin development is Introduction to Plugin Development by WordPress. WebAppick provides and prefers developers to learn about WordPress plugin development from a tutorial by Hasin Hayder. Here is the link ওয়ার্ডপ্রেস প্লাগইন ডেভেলপমেন্ট.
Credentials:
username:
password:
If these credentials are not working please ask for credentials to who are concern.
- Plugin Security
- Check User Capability.
- Data Validation
- Data Sanitization
- Data Escaping
- Nonce
- Hooks
- Few Methods To Understand Hooks
1. add_action() 2. do_action() 3. add_filter() 4. apply_filter() 5. has_filter() 6. did_action() 7. remove_filter() 8. remove_action() 9. current_action() 10. current_filter() 12. remove_all_actions() 13. remove_all_filters()
- AJAX
- Cron Job
- Internationalization
- ShorCode
- Custom Post Type
- Taxonomies
The best resource for learning about WordPress theme development is Introduction to Theme Development by WordPress. WebAppick provides and prefer developers to learn about WordPress plugin development from a tutorial by Hasin Hayder. Here is the link ওয়ার্ডপ্রেস থিম ডেভেলপমেন্ট.
Credentials:
username:
password:
If these credentials are not working please ask for credentials to who are concern.
The best resource for learning about WordPress Rest API development is REST API Handbook by WordPress. WebAppick prefer developers to learn about WordPress Rest API development from a tutorial by Tarek Hasan. Here is the link Introduction to REST API in WordPress.
Warning
This tutorial is not beginner friendly. First read and practice about Rest API from documentation by WordPress mentioned above. Then try to view this tutorial by Tarek Hasan
We'll configure codeception for wpunit testing. Below step by step shown how to set up project.
- Add
require-dev
composer packages tocomposer.json
file"codeatcode/codeatcs": "^1.0", "codeception/codeception": "^4.2", "codeception/module-asserts": "^1.0", "codeception/module-cli": "^1.0", "codeception/module-db": "^1.0", "codeception/module-filesystem": "^1.0", "codeception/module-phpbrowser": "^1.0", "codeception/module-rest": "^1.2", "codeception/module-webdriver": "^1.0", "codeception/util-universalframework": "^1.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.7", "ergebnis/composer-normalize": "^2.6", "lucatume/function-mocker": "~1.0", "lucatume/wp-browser": "^3.1", "phpro/grumphp": "^1.13", "phpunit/phpunit": "^9.2", "szepeviktor/phpstan-wordpress": "^1.1.2", "php-webdriver/webdriver": "^1.12"
2. Set up the `codeception.dist.yml` file
3. Set up `.env` file. fill params of `env` file constants
WP_ROOT=/Applications/MAMP/htdocs/ctxfeedpro
WP_URL='http://localhost:8888/ctxfeedpro'
WP_URL_S='http://localhost:8888/ctxfeedpro'
WP_DOMAIN='localhost:8888/ctxfeedpro'
DB_HOST='localhost'
DB_NAME='wordpress64'
TEST_DB_NAME='wordpress64'
DB_USER='root'
DB_PASSWORD='root'
DISABLE_ESLINT_PLUGIN=true
EXTEND_ESLINT=true
4. PC Set up Required PHP version 7.4. MacOS usually uses
homebrewPHP. We have to use
MAMP Pro`` PHP for wpunit test.
Here is the process to do it
run the command in your terminal sudo nano ~/.bash_profile
it will open your bash_profile
file.
Add the following to the file
export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"
export PATH=$PATH:/Applications/MAMP/Library/bin
Here first line tels which php version will be used during unit testing. Second tels the path of
MySQL
After the setting php and mysql to bash_profile
now run command
source ~/bash_profile
.
Now all setup is done.
5. Start Unit Test
Write test case and start testing by this command.
php ./vendor/bin/codecept run tests/wpunit/Common/DropdropOptionTest.php —debug
- How to override the path of PHP to use the MAMP path?
- How to add MySQL to $PATH variable to resolve "mysql: command not found"?
Make alias in Mac
alias codecept="php ./vendor/bin/codecept run"
PHPSTAN TEST
php ./vendor/bin/phpstan analyse libs/webappick-product-feed-for-woocommerce/V5/Common/Helper.php
PHPCS TEST
php ./vendor/bin/phpcs libs/webappick-product-feed-for-woocommerce/V5/Common/Helper.php
CODECEPT TEST
php ./vendor/bin/codecept run tests/wpunit/Common/DropdropOptionTest.php —debug
Sick and tired of defending code quality over and over again? GrumPHP will do it for you! This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code. If the tests fail, you won't be able to commit your changes. This handy tool will not only improve your codebase, it will also teach your co-workers to write better code following the best practices you've determined as a team.
GrumPHP has a set of common tasks built-in. You will be able to use GrumPHP with a minimum of configuration.
Use specific php in Mac
First Run The Command.
THEN RUN THIS COMMAND
export export MAMP_PHP=/Applications/MAMP/bin/php/php7.4.21/bin
export PATH=“$MAMP_PHP:$PATH”
For Editing bash_profile file
Sodu nano ~/.bash_profile
Add these 2 line in bash_profile file
export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"
export PATH=$PATH:/Applications/MAMP/Library/bin
Then run this command
source ~/.bash_profile
For Unit Testing we will use codeception. Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides an absolutely new way of writing acceptance, functional and even unit tests. Powered by PHPUnit.
- Run this command for testing a file
php ./vendor/bin/codecept run tests/wpunit/Common/DropdropOptionTest.php --debug
- Run this command for testing a file with specific test case
php vendor/bin/codecept run tests/wpunit/Product/ProductInfoTest.php:test_title --debug
PHPSTAN TEST
php ./vendor/bin/phpstan analyse --standard=CodeatCodingStandard libs/webappick-product-feed-for-woocommerce/V5/Common/Helper.php
PHPCS TEST
php ./vendor/bin/phpcs --standard=CodeatCodingStandard libs/webappick-product-feed-for-woocommerce/V5/Common/Helper.php
https://stackoverflow.com/questions/4145667/how-to-override-the-path-of-php-to-use-the-mamp-path
alias codecept="php ./vendor/bin/codecept run "
alias phpcs='php ./vendor/bin/phpcs --standard=CodeatCodingStandard'
alias phpcbf='php ./vendor/bin/phpcbf --standard=CodeatCodingStandard'
export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"
export PATH=$PATH:/Applications/MAMP/Library/bin
Edit .bashrc
file in home directory
sudo nano ~/.bashrc
alias codecept="php ./vendor/bin/codecept run "
alias phpcs='php ./vendor/bin/phpcs --standard=CodeatCodingStandard'
alias phpcbf='php ./vendor/bin/phpcbf --standard=CodeatCodingStandard'
export PATH="/Applications/MAMP/bin/php/php7.4.21/bin:$PATH"
export PATH=$PATH:/Applications/MAMP/Library/bin
alias grumphp=" php ./vendor/bin/grumphp run"
source $(brew --prefix nvm)/nvm.sh
nvm use 14.15.0
https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/ FOR SWITCHING ACCOUNT
$ ssh-add -D
$ ssh-add ~/.ssh/id_azizulhasan
$ ssh-add -D
$ ssh-add ~/.ssh/id_ed25519
Change username and email
Git config user.name “azizulhasan”
Git config user.email “[email protected]”
Path /Applications/MAMP/htdocs/wordpress-develop
https://www.baeldung.com/linux/docker-address-already-in-use
lsof -i:8080 ( port )
source ~/.bash_profile
Reset if there is a problem with running
"env:start": "node ./tools/local-env/scripts/start.js",
"env:stop": "node ./tools/local-env/scripts/docker.js down",
"env:restart": "npm run env:stop && npm run env:start",
"env:clean": "node ./tools/local-env/scripts/docker.js down -v --remove-orphans",
"env:reset": "node ./tools/local-env/scripts/docker.js down --rmi all -v --remove-orphans"
https://wp-punk.com/wordpress-coding-standards-for-php/ https://packagist.org/packages/wp-coding-standards/wpcs