news-ladder/publisher-sdk
Composer 安装命令:
composer require news-ladder/publisher-sdk
包简介
News Ladder PHP SDK to interact with the Publisher API
README 文档
README
The News Ladder SDK is designed to streamline handling transactions and HTTP requests for integration between the News Ladder system and publisher systems. It provides a straightforward way to manage and verify transactions, send requests, and handle origin configurations for allowed services.
Table of Contents
Overview
The News Ladder SDK simplifies integration between News Ladder REST APIs and publisher eco system. It includes classes for managing transactions, sending HTTP requests, and defining origin configurations. With clear methods and examples, it aims to speed up development and ensure robust operations.
Features
- Transaction Handling: Verify and manage transactions with ease.
- HTTP Request Management: A utility class to send HTTP requests with payloads.
- Origin Configuration: Predefined constants for allowed origins and service URLs.
- MIT Licensed: Open-source and free to use.
Installation
The News Ladder SDK is available via Composer. Install it by running:
composer require news-ladder/publisher-sdk
Alternatively, update your composer.json:
{
"require": {
"news-ladder/publisher-sdk": "dev-main"
}
}
Then, execute:
composer install
Dependencies: Ensure you are using PHP 7.4+ with Composer installed.
Usage
Transaction
The Transaction class represents a transaction in the News Ladder system. Use it to verify and manage transactions.
Example:
This object ist a transaction object.
This key values are necessary for the Transaction HTTP Request.
{
"domain": "The domain from the 'become publisher' process",
"magazineKey": "The magazine key from the 'become publisher' process",
"name": "The name of the article, e.g., article title",
"url": "The URL of the article",
"articleEID": "The external page ID; can be a string or any identifier related to the article",
"checkoutToken": "The token from the URL's GET parameter"
}
<?php require 'vendor/autoload.php'; use NewsLadder\PublisherSDK\Transaction; $payload = [ 'domain' => "example.com", 'url' => "https://example.com/article", 'name' => "Example Magazine", 'articleEID' => "12345", 'magazineKey' => "MAG123", 'checkoutToken' => "TOKEN123", ]; $transaction = new Transaction($payload); $response = $transaction->verify(); print_r($response);
Request
The Request class is used to send HTTP requests within the News Ladder system.
Example:
<?php require 'vendor/autoload.php'; use NewsLadder\PublisherSDK\Request; $request = new Request('https://example.com/api', ['param' => 'value']); $response = $request->send($request->url, $request->payload); print_r($response);
Coding Standards:
- Follow PSR-12 coding standards.
- Write clear and concise code comments.
- Include tests for new features.
Feedback: Feel free to report issues or suggest improvements in the issues section.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
news-ladder/publisher-sdk 适用场景与选型建议
news-ladder/publisher-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 12 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 news-ladder/publisher-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 news-ladder/publisher-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-15