code: public static function create($dir) 
      {
          //create dir structure if necesary
          $parts = explode(DIRECTORY_SEPARATOR, $dir);
          $file = array_pop($parts);
          $dir = '';
          foreach($parts as $part)
              if(!is_dir($dir .= DIRECTORY_SEPARATOR.$part)) mkdir($dir);
      
          //create file
          $handle = fopen($dir.DIRECTORY_SEPARATOR.$file, 'cb');
          fclose($handle);
      
          return true;
      }
docs: Create file
  @param string $dir full path and file name
  example /home/coco/readme.md
  @return bool