The Cloudinary class is the main entry point for the SDK. You can initialize it by passing a configuration source to the constructor. Supported configuration sources include an array, a string (typically a path to a configuration file), a Cloudinary\Configuration\Configuration instance, or null to use default settings.
Upon instantiation, the SDK automatically validates the configuration and prepares internal builders for tags and API access.
use Cloudinary\Cloudinary;
use Cloudinary\Configuration\Configuration;
// Option 1: Using an array
$cloudinary = new Cloudinary([
'cloud' => [
'cloud_name' => 'your_cloud_name',
'api_key' => 'your_api_key',
'api_secret' => 'your_api_secret',
]
]);
// Option 2: Using a Configuration object
$config = new Configuration(['cloud' => ['cloud_name' => 'your_cloud_name', ...]]);
$cloudinary = new Cloudinary($config);