2017 © Pedro Peláez
 

library utils

Utils package for frequently used classes and functions

image

csfcloud/utils

Utils package for frequently used classes and functions

  • Wednesday, May 2, 2018
  • by skorkabence
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 100 % Grown

The README.md

CSFCloud Utils

Build Status Code Coverage Packagist, (*1)

Contents

  • Temporary file manager
  • Command executer
  • Recursive file lister

Temporary file manager

Create a new temp file, (*2)

use CSFCloud\TempFiles\TempManager;

$tmp = new TempManager("my_context"); // Create a context
$file = $tmp->createFile(); // Create a new file
$file_path = $file->getPath(); // Get the full path to the file
$id = $file->getId(); // Get the file id, to access this file in an other session

Load existing temp file, (*3)

use CSFCloud\TempFiles\TempManager;

$tmp = new TempManager("my_context"); // Create a context
$file = $tmp->getFile("my_file_id"); // Load the file with the file id

Command executer

Run a command, (*4)

use CSFCloud\Shell\CommandRunner;

$runner = new CommandRunner();
$output_file = $runner->run(CommandRunner::COMMAND_SYNC, __DIR__, "ls");
echo $output_file->getText();
$output_file->delete();

Recursive file finder

Find files recursively in a directory, (*5)

use CSFCloud\RecursiveFileListing;

$finder = new RecursiveFileListing(__DIR__ . "/my_directory");
$files = $finder->scan();

var_dump($files);

Find txt files recursively in a directory, (*6)

use CSFCloud\RecursiveFileListing;

$finder = new RecursiveFileListing(__DIR__ . "/my_directory");
$finder->addFilter('/.*\.txt$/i');
$files = $finder->scan();

var_dump($files);

The Versions

02/05 2018

dev-master

9999999-dev https://github.com/CSFCloud/php-utils

Utils package for frequently used classes and functions

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Bence Skorka