1+ # PHP File Helper
2+
13![ License] ( https://img.shields.io/badge/License-MIT-green.svg )
24[ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/c6450a9c0f99488e93b34911f1adfb2e )] ( https://app.codacy.com/gh/rcsofttech85/php-file-helper/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade )
35[ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Coverage/c6450a9c0f99488e93b34911f1adfb2e )] ( https://app.codacy.com/gh/rcsofttech85/php-file-helper/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage )
46
5- ** A simple php file helper** ✨
7+ A simple PHP file helper for various file operations.
68
7- ==========================================
9+ ---
810
9- ** Installation **
11+ ## Table of Contents
1012
11- ```
13+ - [ About] ( #about )
14+ - [ Installation] ( #installation )
15+ - [ Usage] ( #usage )
16+ - [ Search by Keyword] ( #search-by-keyword )
17+ - [ Search by keyword and return array] ( #search-and-return-array )
18+ - [ Write Multiple Files] ( #write-multiple-files-simultaneously )
19+ - [ Converting File to Array] ( #converting-file-to-an-array )
20+ - [ Find and Replace in CSV] ( #find-and-replace-in-csv-file )
21+ - [ Converting File to JSON] ( #converting-file-to-json-format )
22+ - [ Encrypt and Decrypt Files] ( #encrypt-and-decrypt-files )
23+ - [ Stream and Save Content from URL] ( #stream-and-save-content-from-url-to-file )
24+ - [ File Compression and Decompression] ( #file-compression-and-decompression )
25+ - [ File Difference] ( #file-difference )
26+ - [ File Integrity check] ( #file-integrity-check )
27+ - [ View CSV in Terminal(table format)] ( #view-csv-in-terminal )
28+ - [ View Json in Terminal(table format)] ( #view-json-in-terminal )
29+
30+ ---
31+
32+ ## About
33+
34+ This PHP File Helper is designed to simplify various file-related operations. It offers a range of features to handle
35+ tasks such as searching for keywords in files, converting files to different formats, encrypting and decrypting files,
36+ and more. Whether you're working with CSV, JSON, or plain text files, this library can streamline your file management
37+ processes.
38+
39+ ## Installation
40+
41+ You can install this PHP File Helper library via Composer:
42+
43+ ``` bash
1244composer require rcsofttech85/file-handler
1345
1446```
1547
16- ** search by a keyword in file**
48+ ## Usage
49+
50+ ## search by keyword
1751
1852```
19- $temp = new TempFileHandler();
20- $csv = new CsvFileHandler($temp);
53+ $temp = new TempFileHandler();
54+ $csv = new CsvFileHandler($temp);
2155
22- $findByKeyword = $csv->searchInCsvFile("movies.csv","Twilight","Film");
56+ $findByKeyword = $csv->searchInCsvFile("movies.csv","Twilight","Film");
2357
2458
2559```
2660
27- ** search by a keyword in file and return array**
28-
61+ ## Search and return array
2962```
3063$temp = new TempFileHandler();
3164$csv = new CsvFileHandler($temp);
@@ -48,7 +81,7 @@ $findByKeyword = $csv->searchInCsvFile("movies.csv","Twilight","Film",FileHandle
4881 ];
4982```
5083
51- ** Write multiple file simultaneously: **
84+ ## Write multiple files simultaneously
5285
5386```
5487$fileHandler = new FileHandler();
@@ -63,7 +96,7 @@ $fileHandler->close();
6396
6497```
6598
66- ** converting file to an array**
99+ ## Converting file to an array
67100
68101```
69102
@@ -86,7 +119,7 @@ $data[0] = [
86119
87120```
88121
89- ** Find and replace in csv file**
122+ ## Find and replace in csv file
90123
91124```
92125
@@ -108,7 +141,7 @@ $findByKeyword = $csv->findAndReplaceInCsv("movies.csv","Inception","Twilight",c
108141
109142```
110143
111- ** converting file to a json format**
144+ ## Converting file to json format
112145
113146```
114147
@@ -122,29 +155,19 @@ $findByKeyword = $csv->toJson("movies.csv");
122155
123156```
124157
125- ** Encrypt a file **
158+ ## Encrypt and decrypt files
126159
127160```
128161
129162$secret = getenv('SECRET_KEY');
130163
131164$fileEncryptor = new FileEncryptor('movie.csv', $secret);
132165$fileEncryptor->encryptFile();
133-
134- ```
135-
136- ** Decrypt a file**
137-
138- ```
139-
140- $secret = getenv('SECRET_KEY');
141-
142- $fileEncryptor = new FileEncryptor('movie.csv', $secret);
143166$fileEncryptor->decryptFile();
144167
145168```
146169
147- ** Streaming and Saving Content from URL to File **
170+ ## Stream and save content from url to file
148171
149172```
150173
@@ -154,7 +177,7 @@ $fileEncryptor->decryptFile();
154177
155178```
156179
157- ** File Compression **
180+ ## File compression and decompression
158181
159182```
160183
@@ -163,11 +186,7 @@ $fileEncryptor->decryptFile();
163186
164187 $this->fileHandler->compress($testFile, $compressedZipFilename);
165188
166- ```
167189
168- ** File Decompression**
169-
170- ```
171190
172191 $compressedZipFilename = 'compressed.zip';
173192 $extractPath = 'extracted_contents';
@@ -176,14 +195,14 @@ $fileEncryptor->decryptFile();
176195
177196```
178197
179- ** File Difference**
198+ ## File Difference
180199
181200```
182201vendor/bin/file-diff oldFile newFile
183202
184203```
185204
186- ** File Integrity check **
205+ ## File Integrity Check
187206
188207```
189208$fileHasher = new FileHashChecker();
@@ -194,13 +213,21 @@ $fileHasher->verifyHash($hashListFile);
194213
195214```
196215
197- ** open csv file in terminal**
216+ ## View csv in terminal
198217
199218```
200219vendor/bin/view-csv movies.csv --hide-column Film --limit 5
201220
202221```
203222
223+ ## View json in terminal
224+
225+ ```
226+ vendor/bin/view-json movies.json --hide-column Film --limit 5
227+
228+ ```
229+
230+
204231
205232
206233
0 commit comments