PHP quick start
Last updated: Jul-25-2025
This quick start lets you get an end-to-end implementation up and running using the PHP SDK in 5 minutes or less.
Prerequisites
1. Set up and configure the SDK
Install the SDK
Use Composer
to manage your PHP library dependency, and install Cloudinary's PHP library.
-
Run the following command in the root folder of your project to add the SDK and update your
composer.json
: -
Install dependencies, including Cloudinary's PHP package, by running the following command:
NoteIf you don't have the necessary permissions you can run the file itself:php composer.phar install
.
Configure Cloudinary
In a new PHP file, php_quickstart.php
, use your API environment variable to configure your Cloudinary credentials. Replace cloudinary://my_key:my_secret@my_cloud_name
with your actual environment variable value:
2. Upload an image
Use the upload
method of the UploadApi
class to upload assets to Cloudinary. The code is encased in HTML to format and display the response:
3. Get info about the image
Use the asset
method of the AdminApi
class to return the details of our uploaded asset. The code is encased in HTML to format and display the response:
4. Transform and deliver the image
Use the imageTag
method to generate the full image URL based on the specified transformation parameters and add the image tag to your HTML code:
5. Run your code
Run your file by entering the following command in your terminal:
You’ll see console output for each step of the quick start. Click the generated URLs to view your uploaded image in the browser.
View the completed code
You can fork the sample code for this quick start from GitHub.
Next steps
- Learn more about the PHP SDK by visiting the other pages in this SDK guide.
- Get comprehensive details about Cloudinary features and capabilities:
- Upload guide: Provides details and examples of the upload options.
- Image transformations guide: Provides details and examples of the transformations you can apply to image assets.
- Video transformations guide: Provides details and examples of the transformations you can apply to video assets.
- Transformation URL API Reference: Provides details and examples of all available transformation parameters.
- Admin API guide: Provides details and examples of the methods available for managing and organizing your media assets.