PHP: Passing Arguments from Bash To PHP



echo "Testing destination dir -" $ytuDest

PHP Main

 * Start of PHP CLI Script
//require_once '/home/silosix/git/phpunitwebdriver/src/Shell/YtdlWrapper.php';
//require_once '../Shell/YtdlWrapper.php';
print "Downloading YT Videos: START"."\n";
print "parsing arguments"."\n";
$ytuDest = $output['ytuDest'];
print "ytuDest=" .

PHPUnit: Resources


PHP Sticking Points
* Strong Typing
    * False positives
    * Interpreting Code Intent
    * Debugging tests difficult, primary with larger teams
        * swapping int/string function arguments doesn't produce any IDE errors, so must detect/debug runtime.... could go undetected
    * Framework changes can create a multitude of undetected problems
* Return types limited
    * can't return Array of Objects, so IDE intellisense breaks
        * broken intellisense can't detect logic errors
        * trial and error required for using object functions since code hints not available.
*  Enums & other constructs not available


PHP: REST Client iwith OAuth2 support

I downloaded the server version (PDO) available for the OAuth 2.0 here:

Not sure if it is the best implementation out there honestly.

It is configured and currently returns an error JSON indicating it is waiting for a client to pass it the correct arguments.

Now, it comes with a "lib" folder that has a Client .inc file. Honestly, I am not sure how to use it given there is no PHP example I found in the archive and couldn't find anything online. I found an example for Drupal using this library, but it is a mess given they have their own Drupal-related functionalities as a module.




PHPUnit-Webdriver: 09 - PhantomJS ( GhostDriver )

  • PhantomJS has ghostdriver embedded so it is an all-in-one package
  • PhantomJS has crashes periodically, so have some concerns about using it.
  • As of 2018.11.28:
    • [FOR PHP] I currently prefer to use chromedriver with the --headless CLI spec for CI/CD use
      • if only to ensure consistent runtime & capability support
    • There are good reasons to implement other drivers - but I'd lean towards implementing other webdrivers AFTER a chromedriver solution is build & stable.
      • Then FireFox & IE headful
      • Then these two in headless
    • FireFox PHP driver currently has issues with the php-webdriver(Facebook WebDriver), so have not implemented FF in my latest PHPUnit-php-webdriver framework.



PHP: __DIR__ and __FILE__ and including 'config.php' files


I suggest defining it as a constant so that it can't be altered and is available no matter the scope.




Keep in mind that __DIR__ will reference the directory that config.php is in. If config.php is the parent folder of projectfiles then the above will work.


Subscribe to PHP