{"id":13519559,"url":"https://github.com/kraken-io/kraken-php","last_synced_at":"2026-04-02T02:17:16.808Z","repository":{"id":6556099,"uuid":"7797824","full_name":"kraken-io/kraken-php","owner":"kraken-io","description":"Official Kraken.io library for PHP - https://kraken.io","archived":false,"fork":false,"pushed_at":"2025-08-18T18:25:40.000Z","size":194,"stargazers_count":129,"open_issues_count":2,"forks_count":34,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-12-21T09:33:33.530Z","etag":null,"topics":["api-client","image-optimization","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kraken-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-01-24T12:48:47.000Z","updated_at":"2025-08-18T18:25:43.000Z","dependencies_parsed_at":"2025-03-31T13:52:58.569Z","dependency_job_id":"66038e9f-5efd-49e7-89b2-2317608b7852","html_url":"https://github.com/kraken-io/kraken-php","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/kraken-io/kraken-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraken-io%2Fkraken-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraken-io%2Fkraken-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraken-io%2Fkraken-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraken-io%2Fkraken-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kraken-io","download_url":"https://codeload.github.com/kraken-io/kraken-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kraken-io%2Fkraken-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","image-optimization","php-library"],"created_at":"2024-08-01T05:02:00.516Z","updated_at":"2026-04-02T02:17:16.789Z","avatar_url":"https://github.com/kraken-io.png","language":"PHP","readme":"PHP library for Kraken.io Image Optimizer API\n==========\n\nThis is the official Kraken.io PHP library, which should help users very quickly integrate our Image Optimization into their PHP projects. [Kraken.io](http://kraken.io/) Image Optimizer.\n\n* [Installation](#installation)\n* [Getting Started](#getting-started)\n* [Downloading Images](#downloading-images)\n* [How To Use](#how-to-use)\n* [Wait and Callback URL](#wait-and-callback-url)\n  * [Wait Option](#wait-option)\n  * [Callback URL](#callback-url)\n* [Authentication](#authentication)\n* [Usage - Image URL](#usage---image-url)\n* [Usage - Image Upload](#usage---image-upload)\n* [Lossy Optimization](#lossy-optimization)\n* [Image Resizing](#image-resizing)\n* [WebP Compression](#webp-compression)\n* [Image Type Conversion](#image-type-conversion)\n* [Preserving Metadata](#preserving-metadata)\n* [External Storage](#external-storage)\n  * [Amazon S3](#amazon-s3)\n  * [Rackspace Cloud Files](#rackspace-cloud-files)\n  * [Microsoft Azure](#microsoft-azure)\n  * [SoftLayer Object Storage](#softlayer-object-storage)\n\n## Installation\n\n### Composer\n\nIf you're using [Composer](http://getcomposer.org/), you can simply add a dependency on `kraken-io/kraken-php` to your project's `composer.json` file. Here's an example of a dependency on version 1.2:\n\n```json\n{\n    \"require\": {\n        \"kraken-io/kraken-php\": \"^1.2\"\n    }\n}\n```\n\nAlternatively you can also execute the following command in your project's root directory:\n\n```\ncomposer require kraken-io/kraken-php\n```\n\n### Git\n\nIf you already have git, the easiest way to download the Kraken-PHP library is with the git command:\n\n```\ngit clone git://github.com/kraken-io/kraken-php.git /path/to/include/kraken\n```\n\n### By Hand\n\nAlternatively, you may download the PHP files from GitHub and place them within your PHP project:\n\n```\nhttps://github.com/kraken-io/kraken-php/archive/master.zip\n```\n\n\n## Getting Started\n\nFirst you need to sign up for the [Kraken.io API](http://kraken.io/plans/) and obtain your unique **API Key** and **API Secret**. You will find both under [API Credentials](http://kraken.io/account/api-credentials). Once you have set up your account, you can start using Kraken.io API in your applications.\n\n## Downloading Images\n\nRemember - never link to optimized images offered to download. You have to download them first, and then replace them in your websites or applications. Due to security reasons optimized images are available on our servers **for one hour** only.\n\n## How to use\n\nYou can optimize your images in two ways - by providing an URL of the image you want to optimize or by uploading an image file directly to Kraken.io API.\n\nThe first option (image URL) is great for images that are already in production or any other place on the Internet. The second one (direct upload) is ideal for your deployment process, build script or the on-the-fly processing of your user's uploads where you don't have the images available online yet.\n\n## Wait and Callback URL\n\nKraken.io gives you two options for fetching optimization results. With the `wait` option set the results will be returned immediately in the response. With the `callback_url` option set the results will be posted to the URL specified in your request.\n\n### Wait option\n\nWith the `wait` option turned on for every request to the API, the connection will be held open until the image has been optimized. Once this is done you will get an immediate response with a JSON object containing your optimization results. To use this option simply set `\"wait\": true` in your request.\n\n**Request:**\n\n````js\n{\n    \"auth\": {\n        \"api_key\": \"your-api-key\",\n        \"api_secret\": \"your-api-secret\"\n    },\n    \"url\": \"http://image-url.com/file.jpg\",\n    \"wait\": true\n}\n````\n\n**Response**\n\n````js\n{\n    \"success\": true,\n    \"file_name\": \"file.jpg\",\n    \"original_size\": 324520,\n    \"kraked_size\": 165358,\n    \"saved_bytes\": 159162,\n    \"kraked_url\": \"http://dl.kraken.io/d1aacd2a2280c2ffc7b4906a09f78f46/file.jpg\"\n}\n````\n\n### Callback URL\n\nWith the Callback URL the HTTPS connection will be terminated immediately and a unique `id` will be returned in the response body. After the optimization is over Kraken.io will POST a message to the `callback_url` specified in your request. The ID in the response will reflect the ID in the results posted to your Callback URL.\n\nWe recommend [RequestBin](https://requestbin.com/) as an easy way to capture optimization results for initial testing.\n\n**Request:**\n\n````js\n{\n    \"auth\": {\n        \"api_key\": \"your-api-key\",\n        \"api_secret\": \"your-api-secret\"\n    },\n    \"url\": \"http://image-url.com/file.jpg\",\n    \"callback_url\": \"http://awesome-website.com/kraken_results\"\n}\n````\n\n**Response:**\n\n````js\n{\n    \"id\": \"18fede37617a787649c3f60b9f1f280d\"\n}\n````\n\n**Results posted to the Callback URL:**\n\n````js\n{\n    \"id\": \"18fede37617a787649c3f60b9f1f280d\"\n    \"success\": true,\n    \"file_name\": \"file.jpg\",\n    \"original_size\": 324520,\n    \"kraked_size\": 165358,\n    \"saved_bytes\": 159162,\n    \"kraked_url\": \"http://dl.kraken.io/18fede37617a787649c3f60b9f1f280d/file.jpg\"\n}\n````\n\n## Authentication\n\nThe first step is to authenticate to Kraken.io API by providing your unique API Key and API Secret while creating a new Kraken.io instance:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n````\n\n## Usage - Image URL\n\nTo optimize an image by providing image URL use the `kraken.url()` method. You will need to provide two mandatory parameters in an array - `url` to the image and `wait` or `callback_url`:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"url\" =\u003e \"http://url-to-image.com/file.jpg\",\n    \"wait\" =\u003e true\n);\n\n$data = $kraken-\u003eurl($params);\n````\n\nDepending on a chosen response option (Wait or Callback URL) in the `data` array you will find either the optimization ID or optimization results containing a `success` property, file name, original file size, kraked file size, amount of savings and optimized image URL:\n\n````php\narray(6) {\n    'success' =\u003e\n    bool(true)\n    'file_name' =\u003e\n    string(8) \"file.jpg\"\n    'original_size' =\u003e\n    int(62422)\n    'kraked_size' =\u003e\n    int(52783)\n    'saved_bytes' =\u003e\n    int(9639)\n    'kraked_url' =\u003e\n    string(65) \"http://dl.kraken.io/d1aacd2a2280c2ffc7b4906a09f78f46/file.jpg\"\n}\n````\n\n## Usage - Image Upload\n\nIf you want to upload your images directly to Kraken.io API use the `kraken-\u003eupload()` method. You will need to provide two mandatory parameters in an array - `file` which is the absolute path to the file and `wait` or `callback_url`.\n\nIn the `$data` array you will find the same optimization properties as with the `url` option above.\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\n## Lossy Optimization\n\nWhen you decide to sacrifice just a small amount of image quality (usually unnoticeable to the human eye), you will be able to save up to 90% of the initial file weight. Lossy optimization will give you outstanding results with just a fraction of image quality loss.\n\nTo use lossy optimizations simply set `\"lossy\" =\u003e true` in your request:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"lossy\" =\u003e true\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\n#### PNG Images\nPNG images will be converted from 24-bit to paletted 8-bit with full alpha channel. This process is called PNG quantization in RGBA format and means the amount of colours used in an image will be reduced to 256 while maintaining all information about alpha transparency.\n\n#### JPEG Images\nFor lossy JPEG optimizations Kraken.io will generate multiple copies of a input image with a different quality settings. It will then intelligently pick the one with the best quality to filesize ration. This ensures your JPEG image will be at the smallest size with the highest possible quality, without the need for a human to select the optimal image.\n\n## Image Resizing\n\nImage resizing option is great for creating thumbnails or preview images in your applications. Kraken.io will first resize the given image and then optimize it with its vast array of optimization algorithms. The `resize` option needs a few parameters to be passed like desired `width` and/or `height` and a mandatory `strategy` property. For example:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"resize\" =\u003e array(\n        \"width\" =\u003e 100,\n        \"height\" =\u003e 75,\n        \"strategy\" =\u003e \"crop\"\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\nThe `strategy` property can have one of the following values:\n\n- `exact` - Resize by exact width/height. No aspect ratio will be maintained.\n- `portrait` - Exact height will be set, width will be adjusted according to aspect ratio.\n- `landscape` - Exact width will be set, height will be adjusted according to aspect ratio.\n- `auto` - The best strategy (portrait or landscape) will be selected for a given image according to aspect ratio.\n- `fit` - This option will crop and resize your images to fit the desired width and height.\n- `square` - This strategy will first crop the image by its shorter dimension to make it a square, then resize it to the specified size.\n- `crop` - This option will crop your image to the exact size you specify with no distortion.\n- `fill` - This strategy allows you to resize the image to fit the specified bounds while preserving the aspect ratio (just like auto strategy). The optional background property allows you to specify a color which will be used to fill the unused portions of the previously specified bounds. The background property can be formatted in HEX notation `#f60` or `#ff6600`, RGB `rgb(255, 0, 0)` or RGBA `rgba(91, 126, 156, 0.7)`. The default background color is white.\n\n**More information about image resizing and cropping can be found in the [Kraken.io API Reference](https://kraken.io/docs/image-resizing)**\n\n## WebP Compression\n\nWebP is a new image format introduced by Google in 2010 which supports both lossy and lossless compression. According to [Google](https://developers.google.com/speed/webp/), WebP lossless images are **26% smaller** in size compared to PNGs and WebP lossy images are **25-34% smaller** in size compared to JPEG images.\n\nTo recompress your PNG or JPEG files into WebP format simply set `\"webp\": true` flag in your request JSON. You can also optionally set `\"lossy\": true` flag to leverage WebP's lossy compression:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"webp\" =\u003e true,\n    \"lossy\" =\u003e true\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\n## Image Type Conversion\n\nKraken.io API allows you to easily convert different images from one type/format to another. If, for example, you would like to turn you transparent PNG file into a JPEG with a grey background Kraken.io API has you covered.\n\nIn order to convert between different image types you need to add an extra `convert` object to you request JSON. This object takes three properties:\n\n- `format` with which you specify the file type you want your image converted into.\n- An optional `background` property where you can specify background colour when converting from transparent file formats such as PNG and GIF into a fully opaque format such as JPEG.\n- An optional `keep_extension` property which allows you to keep the original file extension intact regardless of the output image format.\n\n**Mandatory Parameters:**\n- `format` —    The image format you wish to convert your image into. This can accept one of the following values: `jpeg`, `png` or `gif`.\n\n**Optional Parameters:**\n- `background` —    Background image when converting from transparent file formats like PNG or GIF into fully opaque format like JPEG. The background property can be passed in HEX notation `\"#f60\"` or `\"#ff6600\"`, RGB `\"rgb(255, 0, 0)\"` or RGBA `\"rgba(91, 126, 156, 0.7)\"`. The default background color is white.\n- `keep_extension` —    a boolean value (`true` or `false`) instructing Kraken.io API whether or not the original extension should be kept in the output filename. For example when converting \"image.jpg\" into PNG format with this flag turned on the output image name will still be \"image.jpg\" even though the image has been converted into a PNG. The default value is `false` meaning the correct extension will always be set.\n\n\n## Preserving Metadata\n\nBy default Kraken.io API will **strip all the metadata found in an image** to make the image file as small as it is possible, and in both lossy and lossless modes. Entries like EXIF, XMP and IPTC tags, colour profile information, etc. will be stripped altogether.\n\nHowever there are situations when you might want to preserve some of the meta information contained in the image, for example, copyright notice or geotags. In order to preserve the most important meta entries add an additional `preserve_meta` array to your request with one or more of the following values:\n\n````js\n{\n    \"preserve_meta\": [\"date\", \"copyright\", \"geotag\", \"orientation\", \"profile\"]\n}\n````\n\n- `profile` - will preserve the ICC colour profile. ICC colour profile information adds unnecessary bloat to images. However, preserving it can be necessary in **extremely rare cases** where removing this information could lead to a change in brightness and/or saturation of the resulting file.\n- `date` - will preserve image creation date.\n- `copyright` - will preserve copyright entries.\n- `geotag` - will preserve location-specific information.\n- `orientation` - will preserve the orientation (rotation) mark.\n\nExample integration:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"preserve_meta\" =\u003e array(\"profile\", \"geotag\")\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\n## External Storage\n\nKraken.io API allows you to store optimized images directly in your S3 bucket, Cloud Files container, Azure container or SoftLayer Object Storage container. With just a few additional parameters your optimized images will be pushed to your external storage in no time.\n\n### Amazon S3\n\n**Mandatory Parameters:**\n- `key` - Your unique Amazon \"Access Key ID\".\n- `secret` - Your unique Amazon \"Secret Access Key\".\n- `bucket` - Name of a destination container on your Amazon S3 account.\n- `region` - Name of the region your S3 bucket is located in. This field is mandatory if the region is different from the default one (`us-east-1`). The full list of S3 regions can be found [here](http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region).\n\n**Optional Parameters:**\n- `path` - Destination path in your S3 bucket (e.g. `\"images/layout/header.jpg\"`). Defaults to root `\"/\"`.\n- `acl` - Permissions of a destination object. This can be `\"public_read\"` or `\"private\"`. Defaults to `\"public_read\"`.\n\nThe above parameters must be passed in a `s3_store` key:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"s3_store\" =\u003e array(\n        \"key\" =\u003e \"your-amazon-access-key\",\n        \"secret\" =\u003e \"your-amazon-secret-key\",\n        \"bucket\" =\u003e \"destination-bucket\"\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\nThe `$data` array will contain a `kraked_url` key pointing directly to the optimized file in your Amazon S3 account:\n\n````php\n\"kraked_url\" =\u003e \"http://s3.amazonaws.com/YOUR_CONTAINER/path/to/file.jpg\"\n````\n\n### Rackspace Cloud Files\n\n**Mandatory Parameters:**\n- `user` - Your Rackspace username.\n- `key` - Your unique Cloud Files API Key.\n- `container` - Name of a destination container on your Cloud Files account.\n\n**Optional Parameters:**\n- `path` - Destination path in your container (e.g. `\"images/layout/header.jpg\"`). Defaults to root `\"/\"`.\n- `ssl` - a boolean value (`true` or `false`) instructing Kraken.io API to fetch either SSL or non-SSL URL from Rackspace CloudFiles. Defaults to `false` meaning the non-SSL URL will be returned.\n\nThe above parameters must be passed in a `cf_store` key:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"cf_store\" =\u003e array(\n        \"user\" =\u003e \"your-rackspace-username\",\n        \"key\" =\u003e \"your-rackspace-api-key\",\n        \"container\" =\u003e \"destination-container\",\n        \"ssl\" =\u003e true\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\nIf your container is CDN-enabled, the optimization results will contain `kraked_url` which points directly to the optimized file location in your Cloud Files account, for example:\n\n````php\nkraked_url =\u003e \"http://e9ffc04970a269a54eeb-cc00fdd2d4f11dffd931005c9e8de53a.r2.cf1.rackcdn.com/path/to/file.jpg\"\n````\n\nIf your container is not CDN-enabled optimized file will be stored in your CloudFiles account anyways but the `kraked_url` will point to the optimized image URL in the Kraken.io API Storage:\n\n````php\nkraked_url =\u003e \"http://dl.kraken.io/ecdfa5c55d5668b1b5fe9e420554c4ee/file.jpg\"\n````\n\n\n### Microsoft Azure\n\n**Mandatory Parameters:**\n- `account` - Your Azure Storage Account.\n- `key` - Your unique Azure Storage Access Key.\n- `container` - Name of a destination container on your Azure account.\n\n**Optional Parameters:**\n- `path` - Destination path in your container (e.g. `\"images/layout/header.jpg\"`). Defaults to root `\"/\"`.\n\nThe above parameters must be passed in a `azure_store` key:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"azure_store\" =\u003e array(\n        \"account\" =\u003e \"your-azure-account\",\n        \"key\" =\u003e \"your-azure-storage-access-key\",\n        \"container\" =\u003e \"destination-container\"\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\n### SoftLayer Object Storage\n\n**Mandatory Parameters:**\n- `user` - Your SoftLayer username.\n- `key` - Your SoftLayer API Key.\n- `container` - Name of a destination container on your SoftLayer account.\n- `region` - Short name of the region your container is located in. This can be one of the following:\n`syd01` `lon02` `mon01` `dal05` `tok02`\n`tor01` `hkg02` `mex01` `par01` `fra02`\n`mil01` `sjc01` `sng01` `mel01` `ams01`\n\n**Optional Parameters:**\n- `path` - Destination path in your container (e.g. \"images/layout/header.jpg\"). Defaults to root \"/\".\n- `cdn_url` - A boolean value `true` or `false` instructing Kraken.io API to return a public CDN URL of your optimized file. Defaults to `false` meaning the non-CDN URL will be returned.\n\nThe above parameters must be passed in a `sl_store` object:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n// Minimal request, providing only the mandatory parameters */\n$params = array(\n    \"file\" =\u003e \"/path/to/image/file.jpg\",\n    \"wait\" =\u003e true,\n    \"sl_store\" =\u003e array(\n        \"user\" =\u003e \"your-softlayer-account\",\n        \"key\" =\u003e \"your-softlayer-key\",\n        \"container\" =\u003e \"destination-container\",\n        \"region\" =\u003e \"your-container-location\"\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\nBelow you can find an example of a complete JSON request that uses `sl_store` to push optimized image into your SoftLayer Object Storage container. We will use url option to feed the API with a URL of image to be optimized:\n\n````php\n\u003c?php\n\nrequire_once(\"Kraken.php\");\n$kraken = new Kraken(\"your-api-key\", \"your-api-secret\");\n\n$params = array(\n    \"url\" =\u003e \"http://awesome-website.com/images/header.jpg\",\n    \"wait\" =\u003e true,\n    \"sl_store\" =\u003e array(\n        \"user\" =\u003e \"your-softlayer-account\",\n        \"key\" =\u003e \"your-softlayer-key\",\n        \"container\" =\u003e \"destination-container\",\n        \"region\" =\u003e \"your-container-location\",\n        \"cdn_url\" =\u003e true,\n        \"path\" =\u003e \"images/layout/header.jpg\"\n    )\n);\n\n$data = $kraken-\u003eupload($params);\n````\n\nIf your SoftLayer container is CDN-enabled and you've passed `\"cdn_url\": true` parameter in your JSON request the optimization results will contain `kraked_url` which points directly to the optimized file location in your SoftLayer CDN, for example:\n\n````php\nkraked_url =\u003e \"http://1c231.http.fra02.cdn.softlayer.net/images/layout/header.jpg\"\n````\n\nIf your container is not CDN-enabled `kraked_url` will point to the optimized image URL in the Kraken.io API:\n\n````php\nkraked_url =\u003e \"http://dl.kraken.io/api/ecdfa5c55d5668b1b5fe9e420554c4ee/header.jpg\"\n````\n\n## LICENSE - MIT\n\nCopyright (c) 2013 - 2015 Nekkra UG\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraken-io%2Fkraken-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkraken-io%2Fkraken-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkraken-io%2Fkraken-php/lists"}