dagstuhl/swh-deposit-client
最新稳定版本:0.2.1
Composer 安装命令:
composer require dagstuhl/swh-deposit-client
包简介
SoftwareHeritage Deposit API Client for PHP
README 文档
README
SwhDepositClient
A SoftwareHeritage Deposit API Client for PHP.
License
This project is licensed under the MIT license. See LICENSE.md for details.
Install
composer require dagstuhl/swh-deposit-client
Example
<?PHP use Dagstuhl\SwhDepositClient\SwhDepositClient; use Dagstuhl\SwhDepositClient\SwhDepositMetadata; // Create a client with authorization parameters $client = new SwhDepositClient("https://deposit.staging.swh.network/", "username", "password"); // Create the metadata of a deposit $metadata = new SwhDepositMetadata(); $metadata->add("title", [], "Awesome Project"); $metadata->add("author", [], "Yannick Schillo"); // Import Codemeta-JSON $codemetaJson = json_decode("..."); $metadata->importCodemetaJson($codemetaJson); // Alternatively: $metadata = SwhDepositMetadata::fromCodemetaJson($codemetaJson); $depositMetadata = $metadata->add("swhdeposit:deposit"); $createOrigin = $depositMetadata->add("swhdeposit:create_origin"); $createOrigin->add("swhdeposit:origin", [ "url" => "https://example.com/yannick-schillo/awesome-project/" ]); // Open the archive $archive = fopen("path/to/archive.zip", "r"); // In Laravel: $archive = Storage::readStream("path/to/archive.zip"); // Create the deposit $res = $client->createDeposit("mycollection", true, $metadata, "application/zip", $archive); $depositId = $res->getDepositId(); // Query the status of the deposit $res = $client->getStatus("mycollection", $depositId); var_dump($res->getDepositId()); var_dump($res->getDepositStatus()); var_dump($res->getDepositSwhId()); var_dump($res->getDepositSwhIdContext());
统计信息
- 总下载量: 79
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-10