PHPackages                             dnaklik/dna-exchange-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dnaklik/dna-exchange-bundle

ActiveSymfony-bundle

dnaklik/dna-exchange-bundle
===========================

Happy dna exchange

v1.0.7(1y ago)033MITCSSPHP ^8.1

Since Mar 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/DNAKlik/dna-exchange-bundle)[ Packagist](https://packagist.org/packages/dnaklik/dna-exchange-bundle)[ RSS](/packages/dnaklik-dna-exchange-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (20)Versions (10)Used By (0)

Hello DnaExchangeBundle!
========================

[](#hello-dnaexchangebundle)

DnaExchangeBundle is a way to provide dna stamps to content and users. With this dna the bundle can provide related content or related users.

Install the package with:

```
composer require dnaklik/dna-exchange-bundle
```

And... that's it! If you're *not* using Symfony Flex, you'll also need to enable the `DnaKlik\DnaExchangeBundle\DnaKlikDnaExchangeBundle`in your `AppKernel.php` file.

Usage
-----

[](#usage)

To provide content ans users with dna stamps add this code in your controller. If there is no user logged in the DNA stamps are stored in a session.

```
// 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 .= "".$stamp." (".$stampCount.") ";
                }
                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
```

You can also access this service directly using the id `dnaklik_dna_exchange.dnaklik_exchange`.

Configuration
-------------

[](#configuration)

Some optional parameters can be configured directly by creating a new `config/packages/dnaklik_dna_exchange.yaml` file. The default values are:

```
# config/packages/dnaklik_dna_exchange.yaml
# crossover value
crossOver:    8

# max number off stamps per item
maxStamps: 64

stamp_provider: App\Service\CustomDnaKlikStampProvider
```

Extending the Stamp List
------------------------

[](#extending-the-stamp-list)

If you're feeling *especially* creative and excited, you can customize dna\_exchange to provide it with extra content!

To do that, create a class that implements `DnaKlikStampProvider`: Example of your own stampprovider with content from colors

```
namespace App\Service;

use DnaKlik\DnaExchangeBundle\Service\DnaKlikStampProvider;

class CustomDnaKlikStampProvider extends DnaKlikStampProvider
{
    public function getContent(): array
    {
        $result = $this->dnaExchangeContentStampRepository->StampsInContent();
        foreach($result as $index => $content) {
            $slugParts = explode("/", $content["slug"]);
            $color = $this->manager
                ->getRepository(Color::class)
                ->findOneBy(array("urlName" => $slugParts[2]));
            $result[$index]["property"] = $color->getColor();
        }
        return $result;
    }

    function getContentFromId($id) {
        $result = $this->dnaExchangeContentRepository->findBy(array("id" => $id),array('id'=>'DESC'),3,0);
        foreach($result as $index => $content) {
            $slugParts = explode("/", $content->getSlug());
            $color = $this->manager
                ->getRepository(Color::class)
                ->findOneBy(array("urlName" => $slugParts[2]));
        }
        return $color;
    }

    public function findMatchItems($dna, $max)
    {
        $items = $this->matchDna->findMatchItems($dna, $max);
        foreach($items as $index => $item) {
            $slugParts = explode("/", $item["slug"]);
            $color = $this->manager
                ->getRepository(Color::class)
                ->findOneBy(array("urlName" => $slugParts[2]));
            $items[$index]["property"] = $color->getColor();
        }
        // dump($items);
        return $items;
    }
}
```

There is also an admin to evaluate the progress of the dna exchange: The route to this admin can be configured by creating a new `config/routes/dnaklik_dna_exchange.yaml` file.

```
_dna_exchange:
  resource: '@DnaKlikDnaExchangeBundle/Resources/config/routes.xml'
  prefix: /dna
```

The url to this admin is: &lt;your\_url&gt;/dna/exchange/admin

Contributing
------------

[](#contributing)

Of course, open source is fueled by everyone's ability to give just a little bit of their time for the greater good. If you'd like to see a feature or add some of your *own* happy words, awesome! Tou can request it - but creating a pull request is an even better way to get things done.

Either way, please feel comfortable submitting issues or pull requests: all contributions and questions are warmly appreciated :).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance43

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~31 days

Recently: every ~9 days

Total

8

Last Release

454d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/133c7d3bf8b99f2fd796acfbfbd1dbbc10c004cac83891cf8060f24b248c31d1?d=identicon)[waltermulder](/maintainers/waltermulder)

---

Top Contributors

[![waltermulder](https://avatars.githubusercontent.com/u/3763952?v=4)](https://github.com/waltermulder "waltermulder (14 commits)")[![weaverryan](https://avatars.githubusercontent.com/u/121003?v=4)](https://github.com/weaverryan "weaverryan (6 commits)")[![sh4ka](https://avatars.githubusercontent.com/u/1188509?v=4)](https://github.com/sh4ka "sh4ka (2 commits)")[![bocharsky-bw](https://avatars.githubusercontent.com/u/3317635?v=4)](https://github.com/bocharsky-bw "bocharsky-bw (1 commits)")

---

Tags

symfony-ux

### Embed Badge

![Health badge](/badges/dnaklik-dna-exchange-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/dnaklik-dna-exchange-bundle/health.svg)](https://phpackages.com/packages/dnaklik-dna-exchange-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
