PHP code example of hichemtab-tech / namecrement

1. Go to this page and download the library: Download hichemtab-tech/namecrement 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/ */

    

hichemtab-tech / namecrement example snippets




use HichemTabTech\Namecrement\Namecrement;

$existing = ['file', 'file (1)', 'file (2)'];
$newName = Namecrement::namecrement('file', $existing);

echo $newName; 
// Outputs: "file (3)"

Namecrement::namecrement('file', ['file', 'file -1-', 'file -2-'], ' -%N%-');
// ➔ 'file -3-'

Namecrement::namecrement('version', ['version', 'version<v1>'], '<v%N%>');
// ➔ 'version<v2>'

Namecrement::namecrement('report', ['report', 'report (1)']);
// ➔ 'report (2)'

Namecrement::namecrement('image', ['photo', 'image', 'image (1)', 'image (2)']);
// ➔ 'image (3)'

Namecrement::namecrement('new', []);
// ➔ 'new'
Namecrement::namecrement('file', ['file', 'file (1)', 'file (2)'], ' -%N%-');
// ➔ 'file -1-'

Namecrement::namecrement('file', [], startingNumber: 5);
// → 'file (5)'
bash
composer