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

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

pbxg33k/pbxg33k-traits
======================

A collection of traits to make life with PHP easier

1.1.1(8y ago)73.4k↓100%2MITPHP

Since May 27Pushed 3y ago3 watchersCompare

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

READMEChangelog (2)Dependencies (4)Versions (7)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/5b0372f3f61d8a0a8c454a2c532192fb5908b93ccc02b07841105745591470cd/68747470733a2f2f706f7365722e707567782e6f72672f7062786733336b2f7062786733336b2d7472616974732f762f737461626c65)](https://packagist.org/packages/pbxg33k/pbxg33k-traits) [![Total Downloads](https://camo.githubusercontent.com/11dfeceb07b8ce93d0ff1060e0f3dc75ed3a4b4c750dcf9c09de8cdb1043bae3/68747470733a2f2f706f7365722e707567782e6f72672f7062786733336b2f7062786733336b2d7472616974732f646f776e6c6f616473)](https://packagist.org/packages/pbxg33k/pbxg33k-traits) [![Latest Unstable Version](https://camo.githubusercontent.com/89660a6e5f618512cb6191f686e74a85d47e932f7f6fd803239e4bad87bb5e21/68747470733a2f2f706f7365722e707567782e6f72672f7062786733336b2f7062786733336b2d7472616974732f762f756e737461626c65)](https://packagist.org/packages/pbxg33k/pbxg33k-traits) [![License](https://camo.githubusercontent.com/fc439e233a68d98f880b57e83414cef54299da3cf5496b0726076942fd6aa8a5/68747470733a2f2f706f7365722e707567782e6f72672f7062786733336b2f7062786733336b2d7472616974732f6c6963656e7365)](https://packagist.org/packages/pbxg33k/pbxg33k-traits) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/8815f239cc9e8c6e1f297f9b9f912da1eda5662885e9b4b54fe31fdd334504dc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5042586733336b2f7068702d7472616974732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PBXg33k/php-traits/?branch=master) [![Coverage Status](https://camo.githubusercontent.com/b78fdaedfddac80c505e7ceb62f4b9feee3eea69bda37d9094ad4eab8cf88084/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5042586733336b2f7068702d7472616974732f62616467652e737667)](https://coveralls.io/github/PBXg33k/php-traits)

PBXg33k's PHP Traits
====================

[](#pbxg33ks-php-traits)

This repository is a collection of traits to make life with PHP easier

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

[](#installation)

Add the package-skeleton package to your `composer.json` file.

```
{
    "require": {
        "pbxg33k/pbxg33k-traits": "1.0.*"
    }
}
```

Or via the command line in the root of your project's installation.

```
$ composer require "pbxg33k/pbxg33k-traits*"
```

Traits
------

[](#traits)

- **HydratableTrait** Allows you to easily hydrate classes from arrays. An example is importing data from external APIs
- **ReflectionTrait** Allows you to do extra things with Reflection (ie: get property class from @var block)
- **PropertyTrait** Set property values without worrying about property visibility or setters

Usage
-----

[](#usage)

Click [here](http://php.net/manual/en/language.oop5.traits.php) to read about using traits on PHP's own manual.

### HydratableTrait

[](#hydratabletrait)

```
class Foo
{
    use Pbxg33k\Traits\HydratableTrait;
    // Rest of your class

    // Example property, imagine it has proper getter/setter
    protected $randomProperty;
}

// Somewhere else in code
$foo = new Foo();
$foo->hydrateClass(['randomProperty' => 'value']);

var_dump($foo->getRandomProperty()); // "value"
```

HydratableTrait trait allows you to hydrate your class properties easily by passing an array to hydrateClass(). This trait will automagically assign matching keys to properties and instantiate supported classes.

### ReflectionTrait

[](#reflectiontrait)

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

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md)

License
-------

[](#license)

The MIT License (MIT) Copyright (c) 2016 Oguzhan Uysal.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% 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 ~277 days

Total

3

Last Release

3083d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/056e16095aa1c6f1b8c0f914ca98d0d00fa7289d5c5c78d95face22210102ad5?d=identicon)[PBX\_g33k](/maintainers/PBX_g33k)

---

Top Contributors

[![PBXg33k](https://avatars.githubusercontent.com/u/1777196?v=4)](https://github.com/PBXg33k "PBXg33k (38 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

helpersphpphp-7php-libraryphp-traitsphp7traits

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[jbzoo/composer-diff

See what has changed after a composer update.

53888.9k1](/packages/jbzoo-composer-diff)[baibaratsky/php-wmsigner

WebMoney Signer: a native PHP implementation of the WMSigner module

16399.8k3](/packages/baibaratsky-php-wmsigner)[aak74/bx-data

Классы для удобного доступа к данным в 1C-Bitrix

232.1k](/packages/aak74-bx-data)

PHPackages © 2026

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