PHPackages                             dmytrof/model-flags - 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. [Database &amp; ORM](/categories/database)
4. /
5. dmytrof/model-flags

ActiveLibrary[Database &amp; ORM](/categories/database)

dmytrof/model-flags
===================

Adds flags support to your model/entity

v1.1(2y ago)02.9k↓50%MITPHPPHP &gt;=8.0

Since May 23Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dmytrof/ModelFlags)[ Packagist](https://packagist.org/packages/dmytrof/model-flags)[ RSS](/packages/dmytrof-model-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

ModelFlags
==========

[](#modelflags)

====================

This ligrary helps you to add flags support to your models, entities etc.

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

[](#installation)

```
$ composer require dmytrof/model-flags

```

Usage
-----

[](#usage)

```
class Blog implements ModelWithFlagsInterface
{
    use ModelWithFlagsTrait;

    public const SOME_FLAG1 = 1;
    public const SOME_FLAG2 = 'FLAG_2';

    ...............
};

$blog = new Blog();
$blog->hasFlag(Blog::SOME_FLAG1); // false

// Add flags
$blog
    ->setFlag(Blog::SOME_FLAG1)
    ->setFlag(Blog::SOME_FLAG2)
    ->setFlag('myFlag', false)
;

// Get flugs
$flags = $blog->getFlugs(); // [1 => true, 'FLAG_2' => true, 'myFlag' => false]

// Check flag
$blog->hasFlag(Blog::SOME_FLAG1); // true
$blog->hasFlag('myFlag'); // false

$blog->popFlag(Blog::SOME_FLAG2); // true
$blog->popFlag(Blog::SOME_FLAG2); // false

// Remove flag
$blog->removeFlag('myFlag');

$flags = $blog->getFlugs(); // [1 => true]

```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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 ~292 days

Total

3

Last Release

871d ago

PHP version history (2 changes)v1.0PHP ^7.4 || ^8.0

v1.1PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/009a8ac66b78dc402169d572764a4511788379adcf00045638327226e1ec6d69?d=identicon)[dmytrof](/maintainers/dmytrof)

---

Top Contributors

[![dmytrof](https://avatars.githubusercontent.com/u/13831416?v=4)](https://github.com/dmytrof "dmytrof (10 commits)")

---

Tags

flagentity flagsmodel flags

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dmytrof-model-flags/health.svg)

```
[![Health](https://phpackages.com/badges/dmytrof-model-flags/health.svg)](https://phpackages.com/packages/dmytrof-model-flags)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[stefangabos/world_countries

Constantly updated lists of world countries, territories and areas of geographical interest, with associated alpha-2, alpha-3 and numeric codes as defined by the ISO 3166-1 standard, available in multiple formats and languages, with national flags included

1.6k122.7k1](/packages/stefangabos-world-countries)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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