{"id":22907904,"url":"https://github.com/bynder/bynder-php-sdk","last_synced_at":"2025-04-04T22:02:00.180Z","repository":{"id":18499181,"uuid":"84077949","full_name":"Bynder/bynder-php-sdk","owner":"Bynder","description":"SDK in PHP for integration with Bynder","archived":false,"fork":false,"pushed_at":"2025-03-26T16:46:58.000Z","size":218,"stargazers_count":15,"open_issues_count":5,"forks_count":23,"subscribers_count":62,"default_branch":"master","last_synced_at":"2025-03-28T21:05:14.369Z","etag":null,"topics":["api","integration","php","sdk"],"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/Bynder.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-06T13:44:42.000Z","updated_at":"2025-03-26T16:41:17.000Z","dependencies_parsed_at":"2023-12-12T20:30:57.362Z","dependency_job_id":"acaf610e-ddcf-40af-83dc-ed72d3d4b335","html_url":"https://github.com/Bynder/bynder-php-sdk","commit_stats":{"total_commits":110,"total_committers":22,"mean_commits":5.0,"dds":0.5545454545454546,"last_synced_commit":"513dd015f2586b6b6845c2b628d7cfd6696a3fce"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bynder%2Fbynder-php-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bynder%2Fbynder-php-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bynder%2Fbynder-php-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bynder%2Fbynder-php-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bynder","download_url":"https://codeload.github.com/Bynder/bynder-php-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256102,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","integration","php","sdk"],"created_at":"2024-12-14T03:18:36.662Z","updated_at":"2025-04-04T22:02:00.160Z","avatar_url":"https://github.com/Bynder.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bynder PHP SDK\n![Build](https://github.com/Bynder/bynder-php-sdk/workflows/Build/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/Bynder/bynder-php-sdk/badge.svg?branch=master)](https://coveralls.io/github/Bynder/bynder-php-sdk?branch=master)\n[![Packagist Version](https://img.shields.io/packagist/v/bynder/bynder-php-sdk)](https://packagist.org/packages/bynder/bynder-php-sdk)\n![Packagist Downloads](https://img.shields.io/packagist/dt/bynder/bynder-php-sdk)\n\nThe main goal of this SDK is to speed up the integration of Bynder customers who use PHP. Making it easier to connect to the Bynder API (https://bynder.docs.apiary.io) and executing requests on it.\n\n## Requirements and dependencies\n\nThe PHP SDK requires the following in order to fully work:\n\n- [`PHP \u003e= 5.6`](https://secure.php.net/manual/en/book.curl.php), older versions of PHP not recommended\n- [`curl`](https://secure.php.net/manual/en/book.curl.php), although you can use your own non-cURL client if you prefer\n\nComposer should handle all the dependencies automatically.\n\n## Composer package\n\nThe Bynder PHP SDK is published as a composer package in [packagist](https://packagist.org) and can be found here:\n\n```\nhttps://packagist.org/packages/bynder/bynder-php-sdk\n```\n\n## Installation\n\nThis SDK depends on a few libraries in order to work, installing it with Composer should take care of everything automatically.\n\nTo install the SDK with [Composer](http://getcomposer.org/). Run the following command at the root of the project:\n\n```bash\ncomposer require bynder/bynder-php-sdk\n```\n\nTo use the SDK, we use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading) in order to include all the files automatically:\n\n```php\nrequire_once('vendor/autoload.php');\n```\n\n## How to use it\n\nThis is a simple example on how to retrieve data from the Bynder asset bank. For a more detailed example of implementation refer to the [sample code](https://github.com/Bynder/bynder-php-sdk/blob/master/sample/sample.php).\n\nBefore executing any request to the Bynder API we need to instantiate the **BynderApi** class, the following example shows how to use the **BynderApiFactory** to construct a **BynderApi** instance:\n```php\n    $bynder = new BynderClient(new Configuration(\n        $bynderDomain,\n        $redirectUri,\n        $clientId,\n        $clientSecret\n    ));\n```\n\nThe SDK allows the usage of the [Guzzle request options](http://docs.guzzlephp.org/en/latest/request-options.html).\nThis can be done by passing the last argument when initiating the\nConfiguration object:\n\n```php\n    $requestOptions = ['proxy' =\u003e 'http://MY-PROXY.URL:PORT_NUM'];\n    $bynderApi = BynderClient(new Configuration(\n       ...,\n       $requestOptions\n    ));\n\n```\n\nAfter getting the **BynderClient** service configured successfully we need to get an instance of the **AssetBankManager** in order to do any of the API calls relative to the Bynder Asset Bank module:\n\n```php\n $assetBankManager = $bynder-\u003egetAssetBankManager();\n```\nAnd with this, we can start our request to the API, listed in the **Methods Available** section following. Short example of getting all the **Media Items**:\n\n```php\n $mediaList = $assetBankManager-\u003egetMediaList();\n```\nThis call will return a list with all the Media Items available in the Bynder environment. Note that some of the calls accept a query array in order to filter the results via the API call params (see [Bynder API Docs](http://docs.bynder.apiary.io/)) for more details.\nFor instance, if we only wanted to retrieve **2 images** here is what the call would look like:\n```php\n    $mediaList = $assetBankManager-\u003egetMediaList(\n        [\n          'limit' =\u003e 2,\n          'type' =\u003e 'image'\n        ]\n   );\n```\n\nAll the calls are **Asynchronous**, which means they will return a **Promise** object, making it a bit more flexible in order to adjust to any kind of application.\nAgain, for a more thorough example there is a sample [application use case](sample/sample.php) in this repo.\n\n### Client Credentials\n\nOAuth can be used via authorization code or client credentials. To use client credentials, initialize a Bynder client \nwith OAuth2 Configuration and make call to get a token via:\n\n`$bynder-\u003egetAccessTokenClientCredentials();`\n\nSample file found in `sample/OAuthClientCredentialsSample.php`.\n\n`php OAuthClientCredentialsSample.php`\n\n## Methods Available\nThese are the methods currently available on the **Bynder PHP SDK**, refer to the [Bynder API Docs](http://docs.bynder.apiary.io/)) for more specific details on the calls.\n\n#### BynderClient:\nHandles the process of generating and setting the access token required for the\nrequests to the API. Also has calls related to users.\n```php\n    getAssetBankManager();\n    getAuthorizationUrl();\n    getAccessToken();\n    getUsers();\n    getUser($userId, $query);\n    getCurrentUser();\n    getSecurityProfile($profileId);\n```\n\n\n#### AssetBankManager:\nAll the Asset Bank related calls, provides information and access to\nMedia management.\n```php\n    getBrands();\n    getMediaList($query);\n    getMediaInfo($mediaId, $versions);\n    getMetaproperties();\n    getMetaproperty($propertyId);\n    getMetapropertyDependencies($propertyId);\n    getMetapropertyOptions($query);\n    getMetapropetryGlobalOptionDependencies();\n    getMetapropertyOptionDependencies($propertyId);\n    getMetapropertySpecificOptionDependencies($propertyId, $optionId, $query);\n    getTags();\n    getCategories();\n    getSmartfilters();\n    uploadFileAsync($data);\n    deleteMedia($mediaId);\n    modifyMedia($mediaId, array $data);\n    getDerivatives();\n    getMediaDownloadLocation($mediaId, $type = 'original');\n    getMediaDownloadLocationByVersion($mediaId, $version);\n    getMediaDownloadLocationForAssetItem($mediaId, $itemId, $hash = false);\n    createUsage($query);\n    getUsage($query);\n    deleteUsage($query);\n    getCollections($query);\n    getCollectionAssets($collectionId);\n```\n\n## Tests\n\n### Using Docker\n\nBuild the Docker image and tag it:\n```bash\ndocker build . -t bynder-php-sdk-tests\n```\n\nRun the tests:\n```bash\ndocker run bynder-php-sdk-tests\n```\n\n### Running it locally\n\nInstall dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:\n\n```bash\n./vendor/bin/phpunit tests\n```\n\nOr to run an individual test file:\n\n```bash\n./vendor/bin/phpunit tests/UtilTest.php\n```\n\n### Sample Files Functionality Testing\n\nScripts within `sample` contain code to execute corresponding functionalities. The purpose is to demonstrate how methods\nare called and provide a convenient method to execute functions.\n\nWithin `sample` create a file called `sample_config.php`. This file will be referenced from sample files.\n\nMake sure all values are populated correctly before running sample files.\n\n\nExample `sample_config.php` file content:\n```php\n\u003c?php\n    $bynderDomain = \"portal.bynder.com\";\n    $redirectUri = \"https://google.com\";\n    $clientId = \u003cyour OAuth2 client id\u003e;\n    $clientSecret = \u003cyour OAuth2 client secret\u003e;\n    $token = null;\n\n    // provide corresponding values to be used within API calls\n    // media id for info\n    $MEDIA_ID_FOR_INFO = \"C078E8EE-C13A-4DA5-86EC8D6F335364EB\";\n    // media id for download url\n    $MEDIA_ID_FOR_DOWNLOAD_URL = \"C078E8EE-C13A-4DA5-86EC8D6F335364EB\";\n    // media id for download url\n    $MEDIA_ITEM_ID_FOR_SPECIFIC_DOWNLOAD_URL = \"C83B261D-715F-4188-809FE1214175A753\";\n    // media id for renaming\n    $MEDIA_ID_FOR_RENAME = \"C078E8EE-C13A-4DA5-86EC8D6F335364EB\";\n    // media id for removal\n    $MEDIA_ID_FOR_REMOVAL = \"C078E8EE-C13A-4DA5-86EC8D6F335364EB\";\n    // collection id to get assets for\n    $GET_COLLECTION_ASSETS_ID = \"615F03BB-D986-4786-B2C085D2F0718230\";\n\n    // metaproperty id to get info for\n    $METAPROPERTY_ID_FOR_INFO = \"0D563E99-218C-4613-86232D416EB7EA8A\";\n    // metaproperty option id to get info for\n    $METAPROPERTY_OPTION_ID_FOR_INFO = \"3C65AFA5-AC94-4223-A54757F373D209D6\";\n    // metaproperty id to get dependency info for\n    $METAPROPERTY_ID_FOR_DEPENDENCY_INFO = \"0D563E99-218C-4613-86232D416EB7EA8A\";\n    // metaproperty id for specific option dependency\n    $METAPROPERTY_ID_FOR_SPECIFIC_OPTION_DEPEND = \"0D563E99-218C-4613-86232D416EB7EA8A\";\n    // metaproperty option id for specific option\n    $METAPROPERTY_OPTION_ID_FOR_SPECIFIC_OPTION_DEPEND = \"DF1CF731-EFDF-484D-84BFD5CF8835B9D7\";\n\n    // media id used for creating asset usage\n    $MEDIA_ID_FOR_ASSET_USAGE=\"C078E8EE-C13A-4DA5-86EC8D6F335364EB\";\n    // integration id used for asset usage\n    $INTEGRATION_ID_FOR_ASSET_USAGE=\"0191a303-9d99-433e-ada4-d244f37e1d7d\";\n?\u003e\n```\nWithin each sample file, OAuth credentials are read in from `sample_config.php`.\nScripts will output authorization url to navigate to retrieve access code (will not open browser automatically, user must click link).\nAccess code is then provided to terminal prompt to retrieve an access token for API calls afterward.\n\n### Command Line Instructions\n\nMake sure both `composer` and `php` are installed locally. From root directory run `composer install` to install packages\nform `composer.json`. Navigate to `sample` directory.\n\n#### Brands Sample\n```bash\nphp BrandsSample.php\n```\n\nMethods Used:\n* getBrands()\n\n#### Collections Sample\n```bash\nphp CollectionsSample.php\n```\n\nMethods Used:\n* getCollections($query)\n* getCollectionAssets($collectionId)\n\n#### Media Sample\n```bash\nphp MediaSample.php\n```\n\nMethods Used:\n* getDerivatives()\n* getMediaList($query)\n* getMediaInfo($mediaId)\n* getMediaDownloadLocation($mediaId)\n* getMediaDownloadLocationByVersion($mediaId, $version)\n* getMediaDownloadLocationForAssetItem($mediaId, $itemId)\n* modifyMedia($mediaId, $data)\n* getMediaInfo($mediaId)\n* deleteMedia($mediaId)\n\n#### Metaproperties Sample\n```bash\nphp MetapropertiesSample.php\n```\n\nMethods Used:\n* getMetaproperties()\n* getMetaproperty($metapropertyId)\n* getMetapropertyDependencies($metapropertyId)\n* getMetapropertyOptions($query)\n* getMetapropetryGlobalOptionDependencies()\n* getMetapropertyOptionDependencies($metapropertyId)\n* getMetapropertySpecificOptionDependencies($metapropertyId, $metapropertyOptionId, $array)\n\n#### Smart Filters Sample\n```bash\nphp SmartFiltersSample.php\n```\n\nMethods Used:\n* getSmartfilters()\n\n\n#### Tags Sample\n```bash\nphp TagsSample.php\n```\n\nMethods Used:\n* getTags()\n\n#### Uploads Sample\n```bash\nphp UploadsSample.php\n```\n\nMethods Used:\n* uploadFileAsync($data)\n* getBrands()\n\n#### Usage Sample\n```bash\nphp UsageSample.php\n```\n\nMethods Used:\n* createUsage($data)\n* getUsage($data)\n* deleteUsage($data)\n\n\n### Docker Instructions\n\nSample files can be executed within Docker container. Makefile contains corresponding commands to run/build Docker container.\n\n`Dockerfile.dev` file is used for container.\n\nMakefile commands are executed from root directory. Run with sudo if permission is needed.\n\nIf needed, pull latest `composer` Docker image `docker pull composer:latest`\n\n#### Makefile commands:\n\nBuild and start up Docker container for PHP SDK using Docker Compose\n```bash\nmake run-php-sdk-docker\n```\n\nStop running Docker container for PHP SDK:\n```bash\nmake stop-php-sdk-docker\n```\n\nRun sample file within Docker container (BrandsSample.php is replaced with target sample file):\n```bash\nmake execute-php-sdk-sample sample-file-name=BrandsSample.php\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbynder%2Fbynder-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbynder%2Fbynder-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbynder%2Fbynder-php-sdk/lists"}