1. Go to this page and download the library: Download dnaklik/dna-exchange-bundle 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/ */
dnaklik / dna-exchange-bundle example snippets
// src/Controller/SomeController.php
use DnaKlik\DnaExchangeBundle\Service\DnaKlikExchange;
use Symfony\Component\HttpFoundation\Request;
// ...
class SomeController
{
public function __construct(Request $request, DnaKlikExchange $dnaKlikExchange, DnaExchangeContentRepository $dnaExchangeContentRepository)
{
$this->dnaKlikExchange = $dnaKlikExchange;
$this->dnaExchangeContentRepository = $dnaExchangeContentRepository;
}
public function detail()
{
$stamp = $this->dnaKlikExchange->getStamp($request);
// ...
}
}
## To find related content:
public function relatedContent(Request $request): response
{
$items = $this->dnaKlikExchange->getRelatedContent($request, 30);
foreach($items as $values) {
$values["slug"];
$content = $this->doctrine
->getRepository(Content::class)
->findOneBy(array("urlName" => $slugParts[2]));
$values["matchCorr"];
foreach($values["stamps"] as $stamp => $stampCount) {
if (isset($values["matchStamps"][$stamp])) {
$dna .= "<span class='match'>".$stamp." (".$stampCount.")</span> ";
}
else {
$dna .= $stamp." (".$stampCount.") ";
}
}
$values["totalStampCount"]);
}
}
## An array with slugs is returned. You can use the slugs to retrieve the related content from your own application