Easiest way to extract specific pages from PDF files?

Hello here,
I am trying to find the easiest way to make a PHP script to extract the first 3 pages of around 1,500 PDF files in batch and then create new PDF files with only those 3 pages inside. Do you know of any “ready to use” PHP library or similar to help me with? Any thoughts are very welcome.

Thank you in advance!