1. Go to this page and download the library: Download waaseyaa/northcloud library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
waaseyaa / northcloud example snippets
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
];
}
}