PHPackages                             keradus/traits - 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. keradus/traits

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

keradus/traits
==============

Traits: general usage traits

v1.0(11y ago)1418011MITPHPPHP &gt;=5.4.0

Since Nov 19Pushed 11y ago2 watchersCompare

[ Source](https://github.com/keradus/Traits)[ Packagist](https://packagist.org/packages/keradus/traits)[ Docs](https://github.com/keradus/Traits)[ RSS](/packages/keradus-traits/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Traits
======

[](#traits)

[![Latest Stable Version](https://camo.githubusercontent.com/f09d25e9a3188c434c67e8e90ac208f98eb311db15cc70a24f67b96b16e87ac6/68747470733a2f2f706f7365722e707567782e6f72672f6b6572616475732f7472616974732f762f737461626c652e737667)](https://packagist.org/packages/keradus/traits)[![Latest Unstable Version](https://camo.githubusercontent.com/ab3748bf901b5b0f18d1279aa2887f07a163f18fd157af462b593d0ffd648125/68747470733a2f2f706f7365722e707567782e6f72672f6b6572616475732f7472616974732f762f756e737461626c652e737667)](https://packagist.org/packages/keradus/traits)[![Build status](https://camo.githubusercontent.com/6374dd15b40a8b731f2527865ce45310182ea0118b61773528d480d9b88bdf18/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6b6572616475732f5472616974732f6d61737465722e737667)](https://travis-ci.org/keradus/Traits)[![SensioLabsInsight](https://camo.githubusercontent.com/1546bca97c09f5704d51e395391c5bf937f2ad4b0b2c0ababceccb042cb37629/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39373537333132302d623039312d346263302d383939342d3765636235346661623138312f6d696e692e706e67)](https://insight.sensiolabs.com/projects/97573120-b091-4bc0-8994-7ecb54fab181)

Traits - general usage traits.

Traits List
-----------

[](#traits-list)

### InaccessiblePropertiesProtectorTrait

[](#inaccessiblepropertiesprotectortrait)

Trait, that protects accessing inaccessible (unknown) properties to help keeping code clean and safe.

```
class Foo
{
    public $baz;
}

$foo = new Foo();
$foo->vaz = 123; // PHP claims that code is OK, even if you misspelled variable name!

class Bar
{
    use InaccessiblePropertiesProtectorTrait;

    public $baz;
}

$bar = new Bar();
$bar->vaz = 123; // now PHP throws \LogicException
```

### InnerClassCacheTrait

[](#innerclasscachetrait)

Trait, that adds functionality of inner class cache.

```
class Foo
{
    use InnerClassCacheTrait;

    public function square($x)
    {
        if (!isset($this->cache[$x])) {
            $this->cache[$x] = $x * $x;
        }

        return $this->cache[$x];
    }
}
```

### InstanceCreationDisallowerTrait

[](#instancecreationdisallowertrait)

Trait, that disallow to create instance of class. Use for protecting static classes (only static members).

```
class Foo
{
    use InstanceCreationDisallowerTrait;

    public static function createInstance()
    {
        return new static();
    }
}

$foo = new Foo(); // PHP throws fatal error
$foo = Foo::createInstance(); // PHP throws \LogicException
```

### PropertyTrait

[](#propertytrait)

Property trait.

### SingletonTrait

[](#singletontrait)

### StaticPropertyTrait

[](#staticpropertytrait)

Property trait in static way.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4197d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2716794?v=4)[Dariusz Rumiński](/maintainers/keradus)[@keradus](https://github.com/keradus)

---

Top Contributors

[![keradus](https://avatars.githubusercontent.com/u/2716794?v=4)](https://github.com/keradus "keradus (8 commits)")

### Embed Badge

![Health badge](/badges/keradus-traits/health.svg)

```
[![Health](https://phpackages.com/badges/keradus-traits/health.svg)](https://phpackages.com/packages/keradus-traits)
```

###  Alternatives

[nsavinov/nova-json-schema-field

A Laravel Nova field for JSON Schema

2698.5k](/packages/nsavinov-nova-json-schema-field)[arrowjustdoit/crontab

Crontab extension for laravel-admin

334.0k](/packages/arrowjustdoit-crontab)[joseym/li3_installer

Lithium PHP (li3) 3rd party library installer.

1312.5k2](/packages/joseym-li3-installer)[ruwer/brcities

Full package with brazilian cities.

124.9k](/packages/ruwer-brcities)

PHPackages © 2026

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