PHP code example of nekland / tools

1. Go to this page and download the library: Download nekland/tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nekland / tools example snippets


StringTools::camelize($str, $from, $encoding, $normalize = true) : string

StringTools::startsWith($str, $start) : bool

StringTools::endsWith($str, $end) : bool

StringTools::removeStart($str, $toRemove) : string

StringTools::removeEnd($str, $toRemove) : string

StringTools::contains($str, $needle) : bool

StringTools::mb_ucfirst($str, $encoding) : string

ArrayTools::removeValue($array, $value) : void

DateTimeComparator::greatest($dateTime1, $dateTime2, $dateTime3, ...) : ?\DateTimeInterface

DateTimeComparator::lowest($dateTime1, $dateTime2, $dateTime3, ...) : ?\DateTimeInterface

TemporaryFile::__construct(TemporaryDirectory $dir = null, string $prefix = '')

// Create a file in temporary folder
$file = new TemporaryFile();

// Create a file inside a temporary directory (see TemporaryDirectory class)
$file = new TemporaryFile($temporaryDir);

// Create a file in a temporary folder with php_ prefix.
$file = new TemporaryFile(null, 'php_');

TemporaryFile::setContent(string $content)
TemporaryFile::getContent(): string

TemporaryFile::getPathname(): string

TemporaryFile::remove()

TemporaryDirectory::__construct(string $dir = null, string $prefix = 'phpgenerated')

// create a new directory
$directory = new TemporaryDirectory();

TemporaryDirectory::getTemporaryFile(): TemporaryFile

TemporaryDirectory::remove(bool $force = false): void

TemporaryDirectory::getPathname(): string