Go to Terminal and open the bash_profile:
vi ~/.bash_profile
Press "i" to insert and copy the following line to the bash_profile script (Make sure that the path matches your XAMPP installation):
export PATH=/Applications/XAMPP/xamppfiles/bin:$PATH
Commit the current changes while pressing ESC and writing :wq + ENTER 

To apply your changes to the current Terminal session, type:
source ~/.bash_profile
or just close and open the Terminal again.