PHP code example of bynder / bynder-php-sdk

1. Go to this page and download the library: Download bynder/bynder-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bynder / bynder-php-sdk example snippets




    $bynder = new BynderClient(new Configuration(
        $bynderDomain,
        $redirectUri,
        $clientId,
        $clientSecret
    ));

    $requestOptions = ['proxy' => 'http://MY-PROXY.URL:PORT_NUM'];
    $bynderApi = BynderClient(new Configuration(
       ...,
       $requestOptions
    ));


 $assetBankManager = $bynder->getAssetBankManager();

 $mediaList = $assetBankManager->getMediaList();

    $mediaList = $assetBankManager->getMediaList(
        [
          'limit' => 2,
          'type' => 'image'
        ]
   );

    getAssetBankManager();
    getAuthorizationUrl();
    getAccessToken();
    getUsers();
    getUser($userId, $query);
    getCurrentUser();
    getSecurityProfile($profileId);

    getBrands();
    getMediaList($query);
    getMediaInfo($mediaId, $versions);
    getMetaproperties();
    getMetaproperty($propertyId);
    getMetapropertyDependencies($propertyId);
    getMetapropertyOptions($query);
    getMetapropetryGlobalOptionDependencies();
    getMetapropertyOptionDependencies($propertyId);
    getMetapropertySpecificOptionDependencies($propertyId, $optionId, $query);
    getTags();
    getCategories();
    getSmartfilters();
    uploadFileAsync($data);
    deleteMedia($mediaId);
    modifyMedia($mediaId, array $data);
    getDerivatives();
    getMediaDownloadLocation($mediaId, $type = 'original');
    getMediaDownloadLocationByVersion($mediaId, $version);
    getMediaDownloadLocationForAssetItem($mediaId, $itemId, $hash = false);
    createUsage($query);
    getUsage($query);
    deleteUsage($query);
    getCollections($query);
    getCollectionAssets($collectionId);


    $bynderDomain = "portal.bynder.com";
    $redirectUri = "https://google.com";
    $clientId = <your OAuth2 client id>;
    $clientSecret = <your OAuth2 client secret>;
    $token = null;

    // provide corresponding values to be used within API calls
    // media id for info
    $MEDIA_ID_FOR_INFO = "C078E8EE-C13A-4DA5-86EC8D6F335364EB";
    // media id for download url
    $MEDIA_ID_FOR_DOWNLOAD_URL = "C078E8EE-C13A-4DA5-86EC8D6F335364EB";
    // media id for download url
    $MEDIA_ITEM_ID_FOR_SPECIFIC_DOWNLOAD_URL = "C83B261D-715F-4188-809FE1214175A753";
    // media id for renaming
    $MEDIA_ID_FOR_RENAME = "C078E8EE-C13A-4DA5-86EC8D6F335364EB";
    // media id for removal
    $MEDIA_ID_FOR_REMOVAL = "C078E8EE-C13A-4DA5-86EC8D6F335364EB";
    // collection id to get assets for
    $GET_COLLECTION_ASSETS_ID = "615F03BB-D986-4786-B2C085D2F0718230";

    // metaproperty id to get info for
    $METAPROPERTY_ID_FOR_INFO = "0D563E99-218C-4613-86232D416EB7EA8A";
    // metaproperty option id to get info for
    $METAPROPERTY_OPTION_ID_FOR_INFO = "3C65AFA5-AC94-4223-A54757F373D209D6";
    // metaproperty id to get dependency info for
    $METAPROPERTY_ID_FOR_DEPENDENCY_INFO = "0D563E99-218C-4613-86232D416EB7EA8A";
    // metaproperty id for specific option dependency
    $METAPROPERTY_ID_FOR_SPECIFIC_OPTION_DEPEND = "0D563E99-218C-4613-86232D416EB7EA8A";
    // metaproperty option id for specific option
    $METAPROPERTY_OPTION_ID_FOR_SPECIFIC_OPTION_DEPEND = "DF1CF731-EFDF-484D-84BFD5CF8835B9D7";

    // media id used for creating asset usage
    $MEDIA_ID_FOR_ASSET_USAGE="C078E8EE-C13A-4DA5-86EC8D6F335364EB";
    // integration id used for asset usage
    $INTEGRATION_ID_FOR_ASSET_USAGE="0191a303-9d99-433e-ada4-d244f37e1d7d";

https://packagist.org/packages/bynder/bynder-php-sdk
bash
composer 
bash
docker build . -t bynder-php-sdk-tests
bash
docker run bynder-php-sdk-tests
bash
./vendor/bin/phpunit tests/UtilTest.php
bash
php BrandsSample.php
bash
php CollectionsSample.php
bash
php MediaSample.php
bash
php MetapropertiesSample.php
bash
php SmartFiltersSample.php
bash
php TagsSample.php
bash
php UploadsSample.php
bash
php UsageSample.php
bash
make run-php-sdk-docker
bash
make stop-php-sdk-docker
bash
make execute-php-sdk-sample sample-file-name=BrandsSample.php