PHPackages                             intracto/smartcode-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. intracto/smartcode-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

intracto/smartcode-bundle
=========================

This bundle provides a way to generate software licenses with Symfony

v1.4(6y ago)43.2k1MITPHPPHP &gt;=7.2

Since May 5Pushed 3y ago28 watchersCompare

[ Source](https://github.com/Intracto/SmartCodeBundle)[ Packagist](https://packagist.org/packages/intracto/smartcode-bundle)[ Docs](https://github.com/intracto)[ RSS](/packages/intracto-smartcode-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (9)Dependencies (4)Versions (8)Used By (0)

Needs maintainer
================

[](#needs-maintainer)

If you use this bundle, contact @tvlooy about ownership.

SmartCodeBundle [![Run tests](https://github.com/Intracto/SmartCodeBundle/actions/workflows/run-test.yml/badge.svg)](https://github.com/Intracto/SmartCodeBundle/actions/workflows/run-test.yml) [![Scrutinizer](https://camo.githubusercontent.com/9ee08825ffa3d74fc12b2ee02a78a98d921bf6d7575436c5d3147db3a80f751c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f496e74726163746f2f536d617274436f646542756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Intracto/SmartCodeBundle/)
=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#smartcodebundle--)

This bundle provides a way to generate software licenses for a given payload.

It has been inspired by the [Promotion Bundle](https://github.com/Sylius/SyliusPromotionBundle) of Sylius.

How to install?
---------------

[](#how-to-install)

Install the bundle via composer

```
composer require intracto/smartcode-bundle

```

Enable the bundle

```
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    // ...

    public function registerBundles()
    {
        $bundles = array(
            // ...,
            new Intracto\SmartCodeBundle\SmartCodeBundle(),
        );

        // ...
    }
}

```

How to run tests?
-----------------

[](#how-to-run-tests)

```

    php bin/phpunit

```

How to get started?
-------------------

[](#how-to-get-started)

Smart codes have to be bound to a payload this can be done by implementing the PayloadInterface.

```
    use Intracto\SmartCodeBundle\Entity\PayloadInterface;
    use Intracto\SmartCodeBundle\Entity\SmartCodeInterface;

    class Payload implements PayloadInterface
    {

        ...

        /**
         * @ORM\OneToMany(targetEntity="Intracto\SmartCodeBundle\Entity\SmartCodeInterface", mappedBy="payload")
         *
         * @var SmartCodes[]|ArrayCollection
         */
        protected $smartCodes;

        ...
    }

```

Now you can get started with the generation. To generate Smart codes you can use the SmartCodeGenerator or create your own by implementing the SmartCodeGeneratorInterface.

This service will allow you to call the function:

```
    public function generate(PayloadInterface $payload, SmartCodeOptions $options)

```

As you can see this has 2 parameters, the first is your payload that you created in step 1 and the 2nd is a model containing all your options.

```
    class SmartCodeOptions
    {
        protected $amount;
        protected $usageLimit;
        protected $expiresAt;
        protected $startsAt;
        protected $batch;

        ...
    }

```

- **Amount**: The amount of smart codes you wish to generate for the given payload.
- **UsageLimit**: The amount of times a smart code can be used.
- **ExpiresAt**: The expiry date for a smart code.
- **StartsAt**: The date a smart code can start being used.
- **Batch**: A name or description you want to give the current generation.

The last thing you would probably want to do is to be able to use these smart codes you just generated. This is possible via the SmartCodeAction service, which you can also overwrite by implementing the SmartCodeActionInterface.

This class has 2 required functions:

```
   public function register(SubjectInterface $subject, SmartCodeInterface $smartCode);

   public function unregister(SubjectInterface $subject, SmartCodeInterface $smartCode);

```

To register or unregister a certain smart code you would need a subject that is going to be using this code. To make such a subject you can implement the SubjectInterface.

```
    use Intracto\SmartCodeBundle\Entity\SmartCodeInterface;
    use Intracto\SmartCodeBundle\Entity\SubjectInterface;

    class User implements SubjectInterface
    {

        ...

        /**
         * @ORM\ManyToMany(targetEntity="Intracto\SmartCodeBundle\Entity\SmartCodeInterface", inversedBy="subjects")
         * @ORM\JoinTable(name="user_smartcode",
         *      joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")},
         *      inverseJoinColumns={@ORM\JoinColumn(name="smartcode_id", referencedColumnName="id")}
         *      )
         *
         * @var SmartCode[]|ArrayCollection
         */
        protected $smartCodes;

        ...

    }

```

###  Health Score

33

—

LowBetter than 73% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 71.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 ~263 days

Recently: every ~393 days

Total

7

Last Release

2471d ago

PHP version history (2 changes)v1.0PHP &gt;=5.3.9

v1.3PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/57f44cb52273c29c230dbd1e9ef080402d53eaebcdd1fafbf5c6b75527b40199?d=identicon)[tvlooy](/maintainers/tvlooy)

![](https://www.gravatar.com/avatar/80809e7caf8341b1bac3d759e2b159a38b9bdab2deee5b0d4d66de6c83b992d1?d=identicon)[IntractoSupport](/maintainers/IntractoSupport)

---

Top Contributors

[![pix-art](https://avatars.githubusercontent.com/u/1973973?v=4)](https://github.com/pix-art "pix-art (23 commits)")[![tvlooy](https://avatars.githubusercontent.com/u/391674?v=4)](https://github.com/tvlooy "tvlooy (8 commits)")[![ymaerschalck](https://avatars.githubusercontent.com/u/1201393?v=4)](https://github.com/ymaerschalck "ymaerschalck (1 commits)")

---

Tags

generatesoftwarelicenses

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/intracto-smartcode-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/intracto-smartcode-bundle/health.svg)](https://phpackages.com/packages/intracto-smartcode-bundle)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[sulu/sulu

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

1.3k1.4M195](/packages/sulu-sulu)[kimai/kimai

Kimai - Time Tracking

4.7k8.7k1](/packages/kimai-kimai)[open-dxp/opendxp

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

9017.2k55](/packages/open-dxp-opendxp)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1715.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

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