PHP code example of emarref / namer
1. Go to this page and download the library: Download emarref/namer 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/ */
emarref / namer example snippets
$strategy = new Emarref\Namer\Strategy\SuffixStrategy();
$detector = new Emarref\Namer\Detector\ArrayDetector(['Taken', 'Taken copy']);
$namer = new Emarref\Namer\Namer($strategy, $detector);
echo $namer->getName('Taken'); // Will return "Taken copy 2"
$namer = $this->get('default_namer');
$unavailableNames = $repository->getUnavailableNames();
$detector = new Emarref\Namer\Detector\ArrayDetector($unavailableNames);
echo $namer->getName('Taken', $detector);