在php中操作srt文件

I have been trying to modify srt file (to make required adjustment in time). What i would like is to take time advancement/latency and srt files from user and manipulate that srt file with provided time shift. And save a new srt file with modified name in the same path? How can i achieve this in plain PHP or Codeigniter.. both will be helpful. Thank you

  00:12:30,332--> 00:12:45,222
  if provided input is 2 second 
   then srt file should be modified with 
    00:12:32,332 --> 00:12:47:222

You can use library like this:

$subtitles = Subtitles::load('subtitles.srt'); // load file
$subtitles->time(2); // add 2 seconds
$subtitles->save('new-subtitles-file.srt');

https://github.com/mantas-done/subtitles