PHP code example of mattgorle / filename-suffixer

1. Go to this page and download the library: Download mattgorle/filename-suffixer 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/ */

    

mattgorle / filename-suffixer example snippets


use Gorle\FilenameSuffixer\FilenameSuffixer;

$filename = 'your_file.jpg'

$safeFilename = FilenameSuffixer::suffix($filename); 
// - your_file.jpg if the file does not already exist
// - your_file-1.jpg if your_file.jpg already exists
// - your_file-2.jpg if your_file-1.jpg already exists
// - etc...

use Gorle\FilenameSuffixer\FilenameSuffixer;

FilenameSuffixer::$extensionSeparator = '_'; 
FilenameSuffixer::$pathSeparator = ':';
FilenameSuffixer::$suffixStartsAt = 31;
FilenameSuffixer::$suffixSeparator = '_';