code: public static function setPermissions($path, $mode=0777, $recursive=true)
    {
      $path = Path::clean($path);
      
      $fs = new Filesystem();
      
      try {
        $fs->chmod($path, $mode, 0000, $recursive);
      } catch(IOExceptionInterface $e){
        return false;
      }
      
      return true;
    }
docs: Chmods files and directories recursively to given permissions.
  
  @param   string  $path   Root path to begin changing mode [without trailing slash].
  @param   string  $mode   Octal representation of the value to change mode.
  @return   boolean  True if successful