PHPackages                             stringkey/bit-magic-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. stringkey/bit-magic-bundle

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

stringkey/bit-magic-bundle
==========================

Symfony bundle that allows you to do bit manipulations in code and with symfony forms

0.0.7(1y ago)0183MITPHPPHP &gt;=8.1

Since Dec 13Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/stringkey/bit-magic-bundle)[ Packagist](https://packagist.org/packages/stringkey/bit-magic-bundle)[ RSS](/packages/stringkey-bit-magic-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (7)Used By (0)

bit-magic-bundle
================

[](#bit-magic-bundle)

Toolkit to manipulate bitfields in code and symfony forms

Using the bundle
================

[](#using-the-bundle)

Installation
------------

[](#installation)

To include the bundle in your Symfony 6.4 LTS or Symfony 7 project, run:

```
composer require stringkey/bit-magic-bundle
```

Creating a Symfony 6.4 demo app
-------------------------------

[](#creating-a-symfony-64-demo-app)

Create a new Symfony 6.4 LTS project

```
symfony new bit-bundle-test --version=lts
```

Include the minimum required bundles

```
composer require maker orm form validator twig-bundle security-csrf
```

Setup the database connection string, since the bundle works with standard integer types there should be no issues with any database create a .env.local file

```
cp .env .env.local
```

And create the database

```
php bin/console doctrine:database:create
```

Create an entity

```
php bin/console make:entity BitmaskTest
```

Add 2 integer properties and name them

- enableMask
- valueMask

After creating the entity, generate the migration and execute it

```
php bin/console doc:mig:diff
php bin/console doc:mig:mig
php bin/console make:crud BitmaskTest
```

Run the symfony development server

```
symfony serve

```

And navigate to

When clicking new a form with 2 fields are shown, modify the code in: src/Form/BitmaskTestType.php

Don't forget to include the usages

```
use Stringkey\BitMagicBundle\Form\BitMaskType;
use Stringkey\BitMagicBundle\Utilities\BitOperations;
```

Modify the build form method

```
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $choices = BitOperations::createOptions(16, 0xffff); // creates the choice fields

        /** @var BitmaskTest $bitmaskTest */
        $bitmaskTest = $builder->getData(); // fetch the entity
        $enableOption = ['enable_mask' => $bitmaskTest->getEnableMask(), 'choices' => $choices];

        $builder->add('enableMask', BitMaskType::class, ['choices' => $choices]);
        $builder->add('valueMask', BitMaskType::class, $enableOption);
    }
```

Refresh the create page the form should now show 2 rows of checkboxes the top one controls which fields in the bottom row are enabled

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance57

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

6

Last Release

502d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79e68eafab32a08a1fe4e750fe78efb88c2862b762d9f596bf930a765a6cf9d1?d=identicon)[Stringkey](/maintainers/Stringkey)

---

Top Contributors

[![stringkey](https://avatars.githubusercontent.com/u/11537736?v=4)](https://github.com/stringkey "stringkey (17 commits)")

### Embed Badge

![Health badge](/badges/stringkey-bit-magic-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/stringkey-bit-magic-bundle/health.svg)](https://phpackages.com/packages/stringkey-bit-magic-bundle)
```

###  Alternatives

[pugx/autocompleter-bundle

Add an autocomplete type to forms

93861.6k3](/packages/pugx-autocompleter-bundle)[symfony/ux-toggle-password

Toggle visibility of password inputs for Symfony Forms

26508.0k5](/packages/symfony-ux-toggle-password)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)

PHPackages © 2026

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