如何在没有超时的情况下将第三方API的数据同步到Laravel

I want to save some data from an third party API into my Laravel application. Unfortunately I'm getting a timeout because the controller which fetches the data and saves it into my Laravel model is taking too long.

What is the best way to get this going ?

I basically just wrote the code in an API controller. I know this is not the best way but for testing purposes but it worked.

Here is my controller code

public function updateLibrary()
    {
        $page = 1;
        do {
            $vimeo = Vimeo::request('/me/videos', ['per_page' => 10, 'page' => $page], 'GET');
            foreach ($vimeo['body']['data'] as $video) {
                $vimeo_id = (int) filter_var($video['uri'], FILTER_SANITIZE_NUMBER_INT);
                if (VimeoSync::where('vimeo_id', $vimeo_id)->firstOrCreate([
                    'vimeo_id' => $vimeo_id,
                    'image' => $video['pictures']['sizes'][2]['link'],
                ]));
            }
            $page = $page + 1;
        } while ($vimeo['body']['paging']['next']);
    }