Crons to backup

To backup Database once in a week Minute Hour Day Month Weekday Command 0 0 * * Sat /usr/bin/mysqldump -u<usernam> -p<password> <dbname> | bzip2 -9 -c ><full path to save>/<output file name>$(date +"\%d_\%m_\%Y-\%H:\%M:\%S").sql.bz2 To delete files older than 2 weeks 26 11 * * 6 find <full path to save>/<output file name>*.sql.bz2 -mtime +8 -exec…

Commenting for Doxygen

Mainly 3 types of commenting needs to be done Main page Module pages(Non class) eg: index.php Class pages Sample Project Comment Tips Regexp for searching functions //line containing 'function(' not starting with '}/' ^(?!(.*)\}\/)(.*)function\s+(.+)() Little more advanced version ^(?!(.*)\}\/)(.*)function\s+([^\(\r\n\=]+)\( OR if there is something like $function->, to avoid it ^(?!(.*)\}\/)(.*)function([^->=,'",\r,\n]+)\s+([^\r\n]+) For ES6 JS Classes Make…

PHP Storm With WAMP

Ref Video Steps Open Configuration File >> Settings or Ctrl + Alt + S Click PHP Click on Cli Interpreter Button (three dots) Click on + symbol on the modal window Choose the PHP path(it will automatically come if set in %PATH% environment variable) Set Debbugger extension to the same in php.ini C:\wamp64_v2\bin\php\php7.4.26\ext\php_xdebug-3.1.2-7.4-vc15-x86_64.dll Ensure Debug…

PHP Debugging with Xdebug

Debugging & Testing Debugging and testing are interdependent processes. The purpose of testing is to identify if there are any mistakes in a program’s source code. Similarly the purpose of debugging is to locate that mistake and fix it. Debugging helps the developer to determine the root cause of technical error in order to fix…

Standardized Coding

You are an ace coder, time to think of standardising Coding Style Steps Commenting for Documentation (phpDocumentor/Doxygen etc), Sample Commenting Detecting and clearing mess with PHPMD – PHP Mess Detector , Git , tutorial Ensuring PHP PSR Standard PHP CS PHP_CodeSniffer for PSR 12 full usage Testing , Unit Testing with PHPunit Debugging. There are…

PHP Unit Testing(PHPUnit )

Steps Install PHPUnit with composer Global composer global require –dev phpunit/phpunit PS: Global Composer is in C:\Users\user\AppData\Roaming\Composer folder To test phpunit –version Create phpunit.xml Sample Reference <?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap = "vendor/autoload.php" backupGlobals = "false" testdox = "true" backupStaticAttributes = "false" colors = "true" convertErrorsToExceptions = "true" convertNoticesToExceptions = "true" convertWarningsToExceptions = "true" processIsolation…

Autoloading in PHP

Autoloading feature Autoloading helps us to load the future classes without any pain (see: dozen of include or require), Can be implemented with spl_autoload_register() click Use PSR-4 autoloading click Codes to implement the functionality is here. click For single prefix namespaces first block <?php /** * An example of a project-specific implementation. * * After…