承接 waaseyaa/northcloud 相关项目开发

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

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

waaseyaa/northcloud

最新稳定版本:v0.1.0-alpha.179

Composer 安装命令:

composer require waaseyaa/northcloud

包简介

North Cloud client, content sync, and search provider for Waaseyaa applications

README 文档

README

North Cloud client, content sync, and search provider for Waaseyaa applications.

What this package gives you

  • NorthCloudClient — HTTP client for the North Cloud REST API (search, people, band office, dictionary, crawl jobs).
  • NorthCloudCache — SQLite-backed response cache.
  • NorthCloudSearchProvider — Implements Waaseyaa\Search\SearchProviderInterface so NC becomes a drop-in search backend.
  • NcSyncService + NcSyncWorker + northcloud:sync command — Generic content ingestion orchestrator that pulls NC search hits and persists them as Waaseyaa entities.
  • NcHitToEntityMapperInterface — The extension seam. Implement one of these per target entity type in your app; the package handles everything else.

Installation

composer require waaseyaa/northcloud

Publish the config (optional):

./bin/waaseyaa config:publish northcloud

Set env vars:

NORTHCLOUD_BASE_URL=https://api.northcloud.one
NORTHCLOUD_API_TOKEN=              # only needed for authenticated endpoints

Usage: hooking up content sync in your app

Implement one mapper per entity type you want to populate from North Cloud:

use Waaseyaa\NorthCloud\Sync\NcHitToEntityMapperInterface;

final class NcHitToKnowledgeItemMapper implements NcHitToEntityMapperInterface
{
    public function entityType(): string
    {
        return 'knowledge_item';
    }

    public function dedupField(): string
    {
        return 'source_url';
    }

    public function supports(array $hit): bool
    {
        $topics = $hit['topics'] ?? [];
        return is_array($topics) && in_array('indigenous', $topics, true);
    }

    public function map(array $hit): array
    {
        return [
            'title' => (string) ($hit['title'] ?? ''),
            'body' => (string) ($hit['snippet'] ?? $hit['body'] ?? ''),
            'source_url' => (string) ($hit['url'] ?? ''),
            // ...app-specific fields
        ];
    }
}

Register the mapper in your AppServiceProvider:

$mapperRegistry = $container->get(MapperRegistry::class);
$mapperRegistry->register(new NcHitToKnowledgeItemMapper(/* deps */));

Run a sync:

./bin/waaseyaa northcloud:sync --limit=20
./bin/waaseyaa northcloud:sync --dry-run
./bin/waaseyaa northcloud:sync --since=2026-01-01

Architecture

  NC API
    ↓
NorthCloudClient  ──►  NorthCloudCache (SQLite)
    ↓
NcSyncService  ──►  MapperRegistry  ──►  your NcHitToEntityMapperInterface
    ↓
EntityTypeManager  ──►  persisted entities

One NC hit may produce multiple entities — every registered mapper whose supports() returns true gets to create one.

Status

v0.1.0-alpha — API surface not yet stable. See waaseyaa/framework#TBD for rollout plan.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-04-16