Skip to content

Installation

Before installing the Imagick Image Processor library, ensure your system meets the following requirements:

  • PHP: Version 8.1 or higher
  • Imagick Extension: Version 3.7 or higher

If you don’t have the Imagick extension installed, follow the instructions for your operating system:

Terminal window
sudo apt-get update
sudo apt-get install php-imagick
sudo systemctl restart apache2 # or php-fpm

Check if the Imagick extension is installed and enabled:

Terminal window
php -m | grep imagick

You should see imagick in the output.

The recommended way to install the Imagick Image Processor is through Composer.

If you don’t have Composer installed, download and install it from getcomposer.org.

Run the following command in your project directory:

Terminal window
composer require kenura/imagick

This will:

  • Download the library and its dependencies
  • Add it to your composer.json file
  • Update your composer.lock file
  • Generate the autoloader

In your PHP files, include Composer’s autoloader:

<?php
require_once __DIR__ . '/vendor/autoload.php';
use Kenura\Imagick\ImageProcessor;
// Now you can use the ImageProcessor class
$processor = new ImageProcessor();

If you prefer not to use Composer, you can manually download and include the library:

  1. Download the latest release from GitHub
  2. Extract the files to your project directory
  3. Include the ImageProcessor.php file:
<?php
require_once __DIR__ . '/path/to/src/ImageProcessor.php';
use Kenura\Imagick\ImageProcessor;
$processor = new ImageProcessor();

Create a simple test script to verify everything is working:

<?php
require_once __DIR__ . '/vendor/autoload.php';
use Kenura\Imagick\ImageProcessor;
try {
$processor = new ImageProcessor();
echo "✅ Imagick Image Processor is installed and ready to use!\n";
} catch (Exception $e) {
echo "❌ Error: " . $e->getMessage() . "\n";
}

Run the script:

Terminal window
php test.php

If you see the success message, you’re all set! 🎉

Now that you have the library installed, check out the Quick Start Guide to learn how to use it, or explore the Guides for specific use cases.