The php-heic-to-jpg PHP package is the easiest way to convert HEIC (High-Efficiency Image Container) images to JPEG with PHP and Laravel framework.
Using this package doesn't require any PHP libraries or external dependencies to be installed. The package works by using a binary file created with Golang that ships with this package. The package does the file conversions, and you get a simple interface to go from HEIC or JPEG:
use Maestroerror\HeicToJpg;
// Save the HEIC file as a JPEG
HeicToJpg::convert("image1.heic")->saveAs("image1.jpg");
// Get the content (binary) of the converted file:
HeicToJpg::convert("image1.heic")->get();
This package also provides a convenience method to check if a file is a HEIC file:
use Maestroerror\HeicToJpg;
if (HeicToJpg::isHeic("image.heic")) {
// Your code
}
You can learn more about this package, get full installation instructions, and view the source code on GitHub.