定制 fastcomments/fastcomments-php 二次开发

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

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

fastcomments/fastcomments-php

Composer 安装命令:

composer require fastcomments/fastcomments-php

包简介

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

README 文档

README

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/fastcomments/fastcomments-php.git"
    }
  ],
  "require": {
    "fastcomments/fastcomments-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/fastcomments/client/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: api_key
$config = FastComments\Client\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = FastComments\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer');


$apiInstance = new FastComments\Client\Api\DefaultApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$tenant_id = 'tenant_id_example'; // string
$add_domain_config_params = new \FastComments\Client\Model\AddDomainConfigParams(); // \FastComments\Client\Model\AddDomainConfigParams

try {
    $result = $apiInstance->addDomainConfig($tenant_id, $add_domain_config_params);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->addDomainConfig: ', $e->getMessage(), PHP_EOL;
}

API Clients

The SDK exposes three API client classes:

  • DefaultApi - API-key-authenticated methods for server-side use. Configure an API key as shown in Getting Started.
  • PublicApi - public methods that do not require an API key, safe to call from browsers and mobile apps.
  • ModerationApi - an extensive suite of live and fast moderation APIs. Every ModerationApi method accepts an $sso parameter and can authenticate via SSO or a FastComments.com session cookie.

Using PublicApi

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Public methods do not require an API key.
$apiInstance = new FastComments\Client\Api\PublicApi(
    new GuzzleHttp\Client()
);
$tenant_id = 'tenant_id_example'; // string
$url_id = 'url_id_example'; // string

try {
    $result = $apiInstance->getCommentsPublic($tenant_id, $url_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PublicApi->getCommentsPublic: ', $e->getMessage(), PHP_EOL;
}

Using ModerationApi

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new FastComments\Client\Api\ModerationApi(
    new GuzzleHttp\Client()
);
$sso = 'sso_example'; // string - SSO payload authenticating the moderator

try {
    $result = $apiInstance->getCount([
        'sso' => $sso,
    ]);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ModerationApi->getCount: ', $e->getMessage(), PHP_EOL;
}

API Methods

All URIs are relative to https://fastcomments.com

Class Method HTTP request Description
DefaultApi addDomainConfig POST /api/v1/domain-configs
DefaultApi addHashTag POST /api/v1/hash-tags
DefaultApi addHashTagsBulk POST /api/v1/hash-tags/bulk
DefaultApi addPage POST /api/v1/pages
DefaultApi addSSOUser POST /api/v1/sso-users
DefaultApi aggregate POST /api/v1/aggregate
DefaultApi aggregateQuestionResults GET /api/v1/question-results-aggregation
DefaultApi blockUserFromComment POST /api/v1/comments/{id}/block
DefaultApi bulkAggregateQuestionResults POST /api/v1/question-results-aggregation/bulk
DefaultApi changeTicketState PATCH /api/v1/tickets/{id}/state
DefaultApi combineCommentsWithQuestionResults GET /api/v1/question-results-aggregation/combine/comments
DefaultApi createEmailTemplate POST /api/v1/email-templates
DefaultApi createFeedPost POST /api/v1/feed-posts
DefaultApi createModerator POST /api/v1/moderators
DefaultApi createQuestionConfig POST /api/v1/question-configs
DefaultApi createQuestionResult POST /api/v1/question-results
DefaultApi createSubscription POST /api/v1/subscriptions
DefaultApi createTenant POST /api/v1/tenants
DefaultApi createTenantPackage POST /api/v1/tenant-packages
DefaultApi createTenantUser POST /api/v1/tenant-users
DefaultApi createTicket POST /api/v1/tickets
DefaultApi createUserBadge POST /api/v1/user-badges
DefaultApi createVote POST /api/v1/votes
DefaultApi deleteComment DELETE /api/v1/comments/{id}
DefaultApi deleteDomainConfig DELETE /api/v1/domain-configs/{domain}
DefaultApi deleteEmailTemplate DELETE /api/v1/email-templates/{id}
DefaultApi deleteEmailTemplateRenderError DELETE /api/v1/email-templates/{id}/render-errors/{errorId}
DefaultApi deleteHashTag DELETE /api/v1/hash-tags/{tag}
DefaultApi deleteModerator DELETE /api/v1/moderators/{id}
DefaultApi deleteNotificationCount DELETE /api/v1/notification-count/{id}
DefaultApi deletePage DELETE /api/v1/pages/{id}
DefaultApi deletePendingWebhookEvent DELETE /api/v1/pending-webhook-events/{id}
DefaultApi deleteQuestionConfig DELETE /api/v1/question-configs/{id}
DefaultApi deleteQuestionResult DELETE /api/v1/question-results/{id}
DefaultApi deleteSSOUser DELETE /api/v1/sso-users/{id}
DefaultApi deleteSubscription DELETE /api/v1/subscriptions/{id}
DefaultApi deleteTenant DELETE /api/v1/tenants/{id}
DefaultApi deleteTenantPackage DELETE /api/v1/tenant-packages/{id}
DefaultApi deleteTenantUser DELETE /api/v1/tenant-users/{id}
DefaultApi deleteUserBadge DELETE /api/v1/user-badges/{id}
DefaultApi deleteVote DELETE /api/v1/votes/{id}
DefaultApi flagComment POST /api/v1/comments/{id}/flag
DefaultApi getAuditLogs GET /api/v1/audit-logs
DefaultApi getCachedNotificationCount GET /api/v1/notification-count/{id}
DefaultApi getComment GET /api/v1/comments/{id}
DefaultApi getComments GET /api/v1/comments
DefaultApi getDomainConfig GET /api/v1/domain-configs/{domain}
DefaultApi getDomainConfigs GET /api/v1/domain-configs
DefaultApi getEmailTemplate GET /api/v1/email-templates/{id}
DefaultApi getEmailTemplateDefinitions GET /api/v1/email-templates/definitions
DefaultApi getEmailTemplateRenderErrors GET /api/v1/email-templates/{id}/render-errors
DefaultApi getEmailTemplates GET /api/v1/email-templates
DefaultApi getFeedPosts GET /api/v1/feed-posts
DefaultApi getHashTags GET /api/v1/hash-tags
DefaultApi getModerator GET /api/v1/moderators/{id}
DefaultApi getModerators GET /api/v1/moderators
DefaultApi getNotificationCount GET /api/v1/notifications/count
DefaultApi getNotifications GET /api/v1/notifications
DefaultApi getPageByURLId GET /api/v1/pages/by-url-id
DefaultApi getPages GET /api/v1/pages
DefaultApi getPendingWebhookEventCount GET /api/v1/pending-webhook-events/count
DefaultApi getPendingWebhookEvents GET /api/v1/pending-webhook-events
DefaultApi getQuestionConfig GET /api/v1/question-configs/{id}
DefaultApi getQuestionConfigs GET /api/v1/question-configs
DefaultApi getQuestionResult GET /api/v1/question-results/{id}
DefaultApi getQuestionResults GET /api/v1/question-results
DefaultApi getSSOUserByEmail GET /api/v1/sso-users/by-email/{email}
DefaultApi getSSOUserById GET /api/v1/sso-users/by-id/{id}
DefaultApi getSSOUsers GET /api/v1/sso-users
DefaultApi getSubscriptions GET /api/v1/subscriptions
DefaultApi getTenant GET /api/v1/tenants/{id}
DefaultApi getTenantDailyUsages GET /api/v1/tenant-daily-usage
DefaultApi getTenantPackage GET /api/v1/tenant-packages/{id}
DefaultApi getTenantPackages GET /api/v1/tenant-packages
DefaultApi getTenantUser GET /api/v1/tenant-users/{id}
DefaultApi getTenantUsers GET /api/v1/tenant-users
DefaultApi getTenants GET /api/v1/tenants
DefaultApi getTicket GET /api/v1/tickets/{id}
DefaultApi getTickets GET /api/v1/tickets
DefaultApi getUser GET /api/v1/users/{id}
DefaultApi getUserBadge GET /api/v1/user-badges/{id}
DefaultApi getUserBadgeProgressById GET /api/v1/user-badge-progress/{id}
DefaultApi getUserBadgeProgressByUserId GET /api/v1/user-badge-progress/user/{userId}
DefaultApi getUserBadgeProgressList GET /api/v1/user-badge-progress
DefaultApi getUserBadges GET /api/v1/user-badges
DefaultApi getVotes GET /api/v1/votes
DefaultApi getVotesForUser GET /api/v1/votes/for-user
DefaultApi patchDomainConfig PATCH /api/v1/domain-configs/{domainToUpdate}
DefaultApi patchHashTag PATCH /api/v1/hash-tags/{tag}
DefaultApi patchPage PATCH /api/v1/pages/{id}
DefaultApi patchSSOUser PATCH /api/v1/sso-users/{id}
DefaultApi putDomainConfig PUT /api/v1/domain-configs/{domainToUpdate}
DefaultApi putSSOUser PUT /api/v1/sso-users/{id}
DefaultApi renderEmailTemplate POST /api/v1/email-templates/render
DefaultApi replaceTenantPackage PUT /api/v1/tenant-packages/{id}
DefaultApi replaceTenantUser PUT /api/v1/tenant-users/{id}
DefaultApi saveComment POST /api/v1/comments
DefaultApi saveCommentsBulk POST /api/v1/comments/bulk
DefaultApi sendInvite POST /api/v1/moderators/{id}/send-invite
DefaultApi sendLoginLink POST /api/v1/tenant-users/{id}/send-login-link
DefaultApi unBlockUserFromComment POST /api/v1/comments/{id}/un-block
DefaultApi unFlagComment POST /api/v1/comments/{id}/un-flag
DefaultApi updateComment PATCH /api/v1/comments/{id}
DefaultApi updateEmailTemplate PATCH /api/v1/email-templates/{id}
DefaultApi updateFeedPost PATCH /api/v1/feed-posts/{id}
DefaultApi updateModerator PATCH /api/v1/moderators/{id}
DefaultApi updateNotification PATCH /api/v1/notifications/{id}
DefaultApi updateQuestionConfig PATCH /api/v1/question-configs/{id}
DefaultApi updateQuestionResult PATCH /api/v1/question-results/{id}
DefaultApi updateSubscription PATCH /api/v1/subscriptions/{id}
DefaultApi updateTenant PATCH /api/v1/tenants/{id}
DefaultApi updateTenantPackage PATCH /api/v1/tenant-packages/{id}
DefaultApi updateTenantUser PATCH /api/v1/tenant-users/{id}
DefaultApi updateUserBadge PUT /api/v1/user-badges/{id}
ModerationApi deleteModerationVote DELETE /auth/my-account/moderate-comments/vote/{commentId}/{voteId}
ModerationApi getApiComments GET /auth/my-account/moderate-comments/api/comments
ModerationApi getApiExportStatus GET /auth/my-account/moderate-comments/api/export/status
ModerationApi getApiIds GET /auth/my-account/moderate-comments/api/ids
ModerationApi getBanUsersFromComment GET /auth/my-account/moderate-comments/ban-users/from-comment/{commentId}
ModerationApi getCommentBanStatus GET /auth/my-account/moderate-comments/get-comment-ban-status/{commentId}
ModerationApi getCommentChildren GET /auth/my-account/moderate-comments/comment-children/{commentId}
ModerationApi getCount GET /auth/my-account/moderate-comments/count
ModerationApi getCounts GET /auth/my-account/moderate-comments/banned-users/counts
ModerationApi getLogs GET /auth/my-account/moderate-comments/logs/{commentId}
ModerationApi getManualBadges GET /auth/my-account/moderate-comments/get-manual-badges
ModerationApi getManualBadgesForUser GET /auth/my-account/moderate-comments/get-manual-badges-for-user
ModerationApi getModerationComment GET /auth/my-account/moderate-comments/comment/{commentId}
ModerationApi getModerationCommentText GET /auth/my-account/moderate-comments/get-comment-text/{commentId}
ModerationApi getPreBanSummary GET /auth/my-account/moderate-comments/pre-ban-summary/{commentId}
ModerationApi getSearchCommentsSummary GET /auth/my-account/moderate-comments/search/comments/summary
ModerationApi getSearchPages GET /auth/my-account/moderate-comments/search/pages
ModerationApi getSearchSites GET /auth/my-account/moderate-comments/search/sites
ModerationApi getSearchSuggest GET /auth/my-account/moderate-comments/search/suggest
ModerationApi getSearchUsers GET /auth/my-account/moderate-comments/search/users
ModerationApi getTrustFactor GET /auth/my-account/moderate-comments/get-trust-factor
ModerationApi getUserBanPreference GET /auth/my-account/moderate-comments/user-ban-preference
ModerationApi getUserInternalProfile GET /auth/my-account/moderate-comments/get-user-internal-profile
ModerationApi postAdjustCommentVotes POST /auth/my-account/moderate-comments/adjust-comment-votes/{commentId}
ModerationApi postApiExport POST /auth/my-account/moderate-comments/api/export
ModerationApi postBanUserFromComment POST /auth/my-account/moderate-comments/ban-user/from-comment/{commentId}
ModerationApi postBanUserUndo POST /auth/my-account/moderate-comments/ban-user/undo
ModerationApi postBulkPreBanSummary POST /auth/my-account/moderate-comments/bulk-pre-ban-summary
ModerationApi postCommentsByIds POST /auth/my-account/moderate-comments/comments-by-ids
ModerationApi postFlagComment POST /auth/my-account/moderate-comments/flag-comment/{commentId}
ModerationApi postRemoveComment POST /auth/my-account/moderate-comments/remove-comment/{commentId}
ModerationApi postRestoreDeletedComment POST /auth/my-account/moderate-comments/restore-deleted-comment/{commentId}
ModerationApi postSetCommentApprovalStatus POST /auth/my-account/moderate-comments/set-comment-approval-status/{commentId}
ModerationApi postSetCommentReviewStatus POST /auth/my-account/moderate-comments/set-comment-review-status/{commentId}
ModerationApi postSetCommentSpamStatus POST /auth/my-account/moderate-comments/set-comment-spam-status/{commentId}
ModerationApi postSetCommentText POST /auth/my-account/moderate-comments/set-comment-text/{commentId}
ModerationApi postUnFlagComment POST /auth/my-account/moderate-comments/un-flag-comment/{commentId}
ModerationApi postVote POST /auth/my-account/moderate-comments/vote/{commentId}
ModerationApi putAwardBadge PUT /auth/my-account/moderate-comments/award-badge
ModerationApi putCloseThread PUT /auth/my-account/moderate-comments/close-thread
ModerationApi putRemoveBadge PUT /auth/my-account/moderate-comments/remove-badge
ModerationApi putReopenThread PUT /auth/my-account/moderate-comments/reopen-thread
ModerationApi setTrustFactor PUT /auth/my-account/moderate-comments/set-trust-factor
PublicApi blockFromCommentPublic POST /block-from-comment/{commentId}
PublicApi checkedCommentsForBlocked GET /check-blocked-comments
PublicApi createCommentPublic POST /comments/{tenantId}
PublicApi createFeedPostPublic POST /feed-posts/{tenantId}
PublicApi createV1PageReact POST /page-reacts/v1/likes/{tenantId}
PublicApi createV2PageReact POST /page-reacts/v2/{tenantId}
PublicApi deleteCommentPublic DELETE /comments/{tenantId}/{commentId}
PublicApi deleteCommentVote DELETE /comments/{tenantId}/{commentId}/vote/{voteId}
PublicApi deleteFeedPostPublic DELETE /feed-posts/{tenantId}/{postId}
PublicApi deleteV1PageReact DELETE /page-reacts/v1/likes/{tenantId}
PublicApi deleteV2PageReact DELETE /page-reacts/v2/{tenantId}
PublicApi flagCommentPublic POST /flag-comment/{commentId}
PublicApi getCommentText GET /comments/{tenantId}/{commentId}/text
PublicApi getCommentVoteUserNames GET /comments/{tenantId}/{commentId}/votes
PublicApi getCommentsForUser GET /comments-for-user
PublicApi getCommentsPublic GET /comments/{tenantId}
PublicApi getEventLog GET /event-log/{tenantId}
PublicApi getFeedPostsPublic GET /feed-posts/{tenantId}
PublicApi getFeedPostsStats GET /feed-posts/{tenantId}/stats
PublicApi getGifLarge GET /gifs/get-large/{tenantId}
PublicApi getGifsSearch GET /gifs/search/{tenantId}
PublicApi getGifsTrending GET /gifs/trending/{tenantId}
PublicApi getGlobalEventLog GET /event-log/global/{tenantId}
PublicApi getOfflineUsers GET /pages/{tenantId}/users/offline
PublicApi getOnlineUsers GET /pages/{tenantId}/users/online
PublicApi getPagesPublic GET /pages/{tenantId}
PublicApi getTranslations GET /translations/{namespace}/{component}
PublicApi getUserNotificationCount GET /user-notifications/get-count
PublicApi getUserNotifications GET /user-notifications
PublicApi getUserPresenceStatuses GET /user-presence-status
PublicApi getUserReactsPublic GET /feed-posts/{tenantId}/user-reacts
PublicApi getUsersInfo GET /pages/{tenantId}/users/info
PublicApi getV1PageLikes GET /page-reacts/v1/likes/{tenantId}
PublicApi getV2PageReactUsers GET /page-reacts/v2/{tenantId}/list
PublicApi getV2PageReacts GET /page-reacts/v2/{tenantId}
PublicApi lockComment POST /comments/{tenantId}/{commentId}/lock
PublicApi logoutPublic PUT /auth/logout
PublicApi pinComment POST /comments/{tenantId}/{commentId}/pin
PublicApi reactFeedPostPublic POST /feed-posts/{tenantId}/react/{postId}
PublicApi resetUserNotificationCount POST /user-notifications/reset-count
PublicApi resetUserNotifications POST /user-notifications/reset
PublicApi searchUsers GET /user-search/{tenantId}
PublicApi setCommentText POST /comments/{tenantId}/{commentId}/update-text
PublicApi unBlockCommentPublic DELETE /block-from-comment/{commentId}
PublicApi unLockComment POST /comments/{tenantId}/{commentId}/unlock
PublicApi unPinComment POST /comments/{tenantId}/{commentId}/unpin
PublicApi updateFeedPostPublic PUT /feed-posts/{tenantId}/{postId}
PublicApi updateUserNotificationCommentSubscriptionStatus POST /user-notifications/{notificationId}/mark-opted/{optedInOrOut}
PublicApi updateUserNotificationPageSubscriptionStatus POST /user-notifications/set-subscription-state/{subscribedOrUnsubscribed}
PublicApi updateUserNotificationStatus POST /user-notifications/{notificationId}/mark/{newStatus}
PublicApi uploadImage POST /upload-image/{tenantId}
PublicApi voteComment POST /comments/{tenantId}/{commentId}/vote

Models

Authorization

Authentication schemes defined for the API:

api_key

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

support@fastcomments.com

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 0.0.0
    • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

fastcomments/fastcomments-php 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-27