{"id":14966873,"url":"https://github.com/cb-techservices/yii2-unsplash","last_synced_at":"2026-01-22T05:34:25.670Z","repository":{"id":62500183,"uuid":"129305612","full_name":"cb-techservices/yii2-unsplash","owner":"cb-techservices","description":"This extension provides a Yii2 widget to display an image picker powered by Unsplash images API.","archived":false,"fork":false,"pushed_at":"2018-09-11T18:10:16.000Z","size":2499,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T17:17:30.190Z","etag":null,"topics":["image-picker","unsplash","unsplash-api","yii2-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cb-techservices.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-12T20:07:14.000Z","updated_at":"2018-09-11T18:10:17.000Z","dependencies_parsed_at":"2022-11-02T09:46:13.929Z","dependency_job_id":null,"html_url":"https://github.com/cb-techservices/yii2-unsplash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cb-techservices/yii2-unsplash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb-techservices%2Fyii2-unsplash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb-techservices%2Fyii2-unsplash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb-techservices%2Fyii2-unsplash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb-techservices%2Fyii2-unsplash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cb-techservices","download_url":"https://codeload.github.com/cb-techservices/yii2-unsplash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb-techservices%2Fyii2-unsplash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28656309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":["image-picker","unsplash","unsplash-api","yii2-extension"],"created_at":"2024-09-24T13:37:04.916Z","updated_at":"2026-01-22T05:34:25.654Z","avatar_url":"https://github.com/cb-techservices.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Yii2 Unsplash Extension\n========================\nThis extension provides a Yii2 widget to display an image picker powered by Unsplash images API.\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist cb-techservices/yii2-unsplash \"*\"\n```\n\nor add\n\n```\n\"cb-techservices/yii2-unsplash\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nConfiguration\n------------\nAdd the following to your main.php config file in your Yii project.\n\n**REQUIREMENT:** You must have a valid [developer account](https://unsplash.com/documentation#getting-started) and \"App\" set up with [Unsplash](https://unsplash.com) API.  Once created, use the app's Access Key and the UTM Source (aka Application Name) for your Yii configuration.\n\n```\n'modules' =\u003e [\n\t'unsplash' =\u003e [\n        'class' =\u003e 'cbtech\\unsplash\\UnsplashImagePickerModule',\n        // ... other configurations for the module ...\n        'params'=\u003e[\n        \t'applicationId'\t=\u003e '{ACCESS_KEY}',\n        \t'utmSource' =\u003e '{UTM_SOURCE}',\n        ]\n    ],\t\n],\n```\nUsage\n-----\n\nOnce the extension AND module are installed, simply use it in your code by  :\n\n```php\n\u003c?= \\cbtech\\unsplash\\UnsplashImagePicker::widget([\n\t\t\"search\"=\u003e\"colors\",\n\t\t\"page\"=\u003e1,\n\t\t\"per_page\"=\u003e16,\n\t\t\"orientation\"=\u003e\"landscape\",\n\t\t\"button_text\"=\u003e\"Choose photo from Unsplash\",\n\t\t\"button_class\"=\u003e\"btn btn-success\",\n\t\t\"button_style\"=\u003e\"margin-right:10px;\",\n\t]); ?\u003e\n```\n\nUse Javascript and jQuery to listen for the 'unsplashDownload' event.\n\n```javascript\n\n$(document).bind('unsplashDownload',\"#unsplash-results\",function(event, data){\n\tconsole.log(\"Download Url = = \" + data.downloadUrl);\n\tconsole.log(\"All photo view urls = = \" + data.urls);\n\n\t$.ajax({\n\t\t\"method\":\"POST\",\n\t\t\"url\":\"/project/save-user-project-media-url-ajax\",  //This is a custom PHP script that recieves the download URL of the photo and downloads it to the server.\n\t\t\"data\":{downloadUrl: data.downloadUrl}\n\t}).done(function(response){\n\t\t$(\".file-default-preview\").empty().html(\"\u003cimg src='\" + response.data.media.url + \"' style='width:200px;height:200px;object-fit:cover;'/\u003e\");\n\t});\n});\n\n```\n\nExample PHP action that receives the downloadUrl: \n```php\npublic function actionSaveUserProjectMediaUrlAjax(){\n\t$downloadUrl = \\Yii::$app-\u003erequest-\u003epost(\"downloadUrl\"); //Download URL sent via $_POST\n\t//Do something with the downloadUrl, like use it to download a copy of the photo to your server.\n}\n```\n\n![Image of Yii2 Unsplash Image Picker](./screenshots/Screenshot1.png)\n\n## Acknowledgments\n* Official Unsplash [PHP Library](https://github.com/unsplash/unsplash-php)\n* [Unsplash Developer API](https://unsplash.com/developers) \n* [Yii2 Framework](https://github.com/yiisoft/yii2)  ![Yii2](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)\n\n## License\n\nYii2 Unsplash Extension is available under the MIT license. See the LICENSE file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcb-techservices%2Fyii2-unsplash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcb-techservices%2Fyii2-unsplash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcb-techservices%2Fyii2-unsplash/lists"}