承接 evalue8bv/creditable-paywall 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

evalue8bv/creditable-paywall

Composer 安装命令:

composer require evalue8bv/creditable-paywall

包简介

Official PayWall SDK for Creditable

README 文档

README

Creditable PayWall PHP Package

Latest Stable Version Total Downloads License

The Creditable-Paywall PHP package is a simple and easy-to-use wrapper for the Creditable API. Its purpose is to enable the integration of a Creditable button into an existing paywall system, thus enabling customers to pay for articles on a pay-per-article basis with credits.

Requirements

To use the Creditable pay per article button, the following things are required:

Installation

To install the package, use Composer by running the following command:

composer require evalue8bv/creditable-paywall

Usage

The javascript code of Creditable requires you to have the following HTML elements on your page:

<div id="creditable-container" class="creditable-container">
  <!-- the button -->
  <div id="creditable-button"></div>
  <!-- popup window -->
  <div id="creditable-window"></div>
</div>

Include the following stylesheet in your head element:

<link rel="stylesheet" type="text/css" href="<?= $creditable->getCssDependency(); ?>;" />

Setting environment to dev

require_once 'vendor/autoload.php';

use Creditable\CreditablePayWall;

$apiKey = 'your-api-key-here';
$options = [
    'environment' => 'dev'
];
$creditable = new CreditablePayWall($apiKey, $options);

// Rest of the code

Checking for article access

<?php

require_once 'vendor/autoload.php';

use Creditable\CreditablePayWall;

$apiKey = 'your-api-key-here';
$creditable = new CreditablePayWall($apiKey);

$creditable_article_id = "<<ARTICLE ID>>"; // Alphanumeric (required)
$creditable_article_title = "<<ARTICLE TITLE>>"; // Alphanumeric (required)
$creditable_topic_id = "<<TOPIC ID>>"; // Alphanumeric (required)
$creditable_topic_name = "<<TOPIC NAME>>"; // Alphanumeric (required)
$creditable_topic_desc = "<<TOPIC DESC>>"; // Alphanumeric (optional)
$creditable_topic_url = "<<TOPIC URL>>"; // Alphanumeric (optional)
$creditable_article_url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; // Alphanumeric (required)
$creditable_article_lang = "en-GB"; // ISO (required)
$creditable_article_authors  =   "<<ARTICLE AUTHORS>>";   // Alphanumeric (comma separated) String (optional)
$creditable_article_desc = "<<ARTICLE DESC>>"; // Alphanumeric (optional) teaser, used to tease recommended articles to users)
$creditable_article_tags = "<<TAGS>>"; // Alphanumeric (optional) comma delimited list or json (optional keywords, used to find recommended articles for users)
$creditable_article_img = "<<ARTICLE IMG URL>>"; // Alphanumeric (optional) URL for article image

// GET LOCAL CREDITABLE JWT COOKIE
$creditable_cookie = $_COOKIE['cjwt'] ?? "";

// Example usage
$data = [
    'jwt' => $creditable_cookie,
    'article_id' => $creditable_article_id,
    'article_name' => $creditable_article_title,
    'topic_id' => $creditable_topic_id,
    'topic_name' => $creditable_topic_name,
    'topic_desc' => $creditable_topic_desc,
    'topic_url' => $creditable_topic_url,
    'article_url' => $creditable_article_url,
    'article_lang' => $creditable_article_lang,
    'article_authors' => $creditable_article_authors,
    'article_desc' => $creditable_article_desc,
    'article_tags' => $creditable_article_tags,
    'article_img' => $creditable_article_img
];

try {
    $result = $creditable->check($data);
    if ($result->isPaid()) {
        // Access granted
    } else {
        // Access denied
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

JavaScript footer script:

<!-- creditable scripts -->
<?php if (!$result->isPaid()){ ?>
<script type="text/javascript">
    <!--//
    const cUid = <?= $result->getUid(); ?>;
    var cAff_id = ''; // optional aff_id here
    //-->
</script>
<script src="<?= $creditable->getJsDependency(); ?>"></script>
<?php } ?>

API Documentation

For more information about the Creditable API, please refer to the official documentation.

Contributing

If you would like to contribute, please feel free to submit a pull request on our GitHub repository.

License

This package is released under the Apache license.

Support

Contact: www.creditable.newsinfo@creditable.news — +31 (0)24 350 54 00

evalue8bv/creditable-paywall 适用场景与选型建议

evalue8bv/creditable-paywall 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 22 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「creditable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 evalue8bv/creditable-paywall 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 evalue8bv/creditable-paywall 我们能提供哪些服务?
定制开发 / 二次开发

基于 evalue8bv/creditable-paywall 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-20