First step 1
create file demo.txt in the public folder
and save any text in the file.
Create new controller
SplitController.php
public function split()
{
$myfile = fopen("demo.txt", "r") or die("Unable to open file!");
$file = fread($myfile,filesize("demo.txt"));
fclose($myfile);
$chunked = chunk_split($file, 700);
dd('dd', $chunked);
}
Now create route in web.php
Route::get('/split', [SplitController::class,'split'] );
Now run command php artisan serve
and open this url
http://127.0.0.1:8000/split