PHP Classes

Algosling PHP Rename a File: Change a file name to have the given requirements

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-12-06 (8 months ago) RSS 2.0 feedNot enough user ratingsTotal: 40 All time: 10,878 This week: 455Up
Version License PHP version Categories
algoslingfileanew 1.0MIT/X Consortium ...5PHP 5, Files and Folders
Description 

Author

This package can change a file name to have the given requirements.

It can take the name of a file and a list of requirements that define the characteristics of the new file name.

The class returns a string with the new file name.

Currently, the class supports the following characteristics for the new file name:

- Have capital letters picked randomly

- Have numbers

- Have a unique identifier

- Have an hash of the file name

Picture of The Algoslingers
  Performance   Level  
Name: The Algoslingers <contact>
Classes: 9 packages by
Country: Ghana Ghana
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Recommendations

Instructions

For installation:

  • Option 1: composer require thealgoslingers/algoslingfileanew

OR

  • Option 2: Download package and extract

Example

<?php
use Thealgoslingers\AlgoslingFileanew;
/*
## For file(s) being uploaded to server
## Please upload the file first
## Then use AlgoslingFileanew to rename it

------ HOW TO RENAME FILE AND/OR SAVE TO DIRECTORY ------
       $file = "path-to-your-file.extension";
       $AlgoslingFileanew = new AlgoslingFileanew;
       $newFile = $AlgoslingFileanew->renameFile($file,"Alnum");
       ## SAVE TO DIRECTORY (OPTIONAL) ##
       fopen("directory-path/$newFile","a");
*/
require "../vendor/autoload.php";

$AlgoslingFileanew = new AlgoslingFileanew();
$newFile = strtolower($AlgoslingFileanew->renameFile("textfile.txt","Alnum"));
echo
"Your new file is: $newFile";
?>


Details

Algoslingfileanew

Rename file in unique and pretty way


  Files folder image Files (6)  
File Role Description
Files folder imagesrc (2 files)
Files folder imagetest (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (6)  /  src  
File Role Description
  Plain text file AlgoslingFileanew.php Class Class source
  Accessible without login Plain text file helpers.php Aux. Auxiliary script

  Files folder image Files (6)  /  test  
File Role Description
  Accessible without login Plain text file testing.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:40
This week:0
All time:10,878
This week:455Up