定制 urban-brussels/resourcespace-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

urban-brussels/resourcespace-api

Composer 安装命令:

composer require urban-brussels/resourcespace-api

包简介

PHP wrapper for ResourceSpace API (Open Source Digital Asset Management)

README 文档

README

PHP wrapper for the API of ResourceSpace (Open Source Digital Asset Management).
Method names and attributes based on the RS documentation here: https://www.resourcespace.com/knowledge-base/api/
More features coming soon.

Installation

composer require urban-brussels/resourcespace-api

Usage

use UrbanBrussels\ResourcespaceApi\ResourceSpace;

$path = 'https://media.example.com/api/?'; // Path to the API part of your ResourceSpace instance
$user = 'rs_user'; // A username in your ResourceSpace Instance
$private_key = '3eabfbcbea3404b1b5c2f884ec8e86bf686cff53d484f4fb2744530721ff65dzerrs'; // Available at https://media.example.com/pages/api_test.php

// Create a ResourcespaceApi Connexion
$connexion = new Connexion($path, $user, $private_key);

// Build a query to retrieve one or several resources
$query = new MediaQuery($connexion);

// Find all resources matching a keyword or other criteria...
// https://www.resourcespace.com/knowledge-base/user/special-search-terms
$list = $query->doSearch('Apple')->getResults(); // By keyword
$list = $query->doSearch('!collection204')->getResults(); // By collection
$list = $query->doSearch('!list1000:1001:1002:1003')->getResults(); // By resource id
$list = $query->doSearch('!last10')->getResults(); // Last 10 resources

// ... or do some pagination and sorting if needed
// Based on the ResourceSpace API Documentation: https://www.resourcespace.com/knowledge-base/api/do_search
$list = $query->doSearch('Apple', ['offset' => 0, 'fetchrows' => 10, 'order_by' => 'date', 'sort' => 'desc'])->getResults();
// Based on the ResourceSpace API Documentation: https://www.resourcespace.com/knowledge-base/api/search_get_previews
$list = $query->searchGetPreviews('Apple', ['getsizes' => 'col,thm,scr,pre', 'fetchrows' => 10, 'order_by' => 'date', 'sort' => 'desc'])->getResults(); // Interesting because you retrieve the previews, but don't have access to offset

// You get a collection of Medias that you can hydrate, adding metadata for example 
// Caution: it sends a GET query each time... use it wisely (offsets, cache, etc).
foreach($list->medias as $key => $value) 
{
    $list->medias[$key]->addPreviewsData($connexion); // Add previews (already retrieved if you used "searchGetPreviews" but not with "doSearch")
    $list->medias[$key]->addFieldsData($connexion, 'fr'); // If you use multiple languages, specify the one you want to get
}

统计信息

  • 总下载量: 69
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固