PHPackages                             silvertipsoftware/laravel-trait-pack - 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. silvertipsoftware/laravel-trait-pack

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

silvertipsoftware/laravel-trait-pack
====================================

A basic collection of some useful traits for Laravel

v1.0.0(10y ago)214.8k↓50%1MITPHP

Since Nov 2Pushed 4y ago4 watchersCompare

[ Source](https://github.com/SilvertipSoftware/laravel-trait-pack)[ Packagist](https://packagist.org/packages/silvertipsoftware/laravel-trait-pack)[ RSS](/packages/silvertipsoftware-laravel-trait-pack/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

laravel-trait-pack
==================

[](#laravel-trait-pack)

A basic collection of some useful traits for Laravel 5.

Overview
--------

[](#overview)

Most traits are configurable, and have standardized on a way of storing these config parameters without polluting the property names within the using class.

Trait config parameters are stored in a `$traitConfigs` static property. This is an associative array, where keys are defined by the trait. The ones in this pack use the fully qualified name of the trait, but that is not enforced.

For example,

```
    $traitConfig = [
        'SilvertipSoftware\LaravelTraitPack\HasActiveState' => [ 'field' => 'flag' ]
    ];
```

HasActiveState
--------------

[](#hasactivestate)

Adds an `isActive` method and a scope to a Laravel `Model`. The underlying field name is configurable, and defaults to `active`.

### Example Config

[](#example-config)

```
    $traitConfig = [
        'SilvertipSoftware\LaravelTraitPack\HasActiveState' => [ 'field' => 'flag' ]
    ];
```

UsesAlternateConnection
-----------------------

[](#usesalternateconnection)

Allows configurable connection names per class, or class hierarchies. Particularly useful for libraries. The connection name can either be defined directly on the class using:

```
    $traitConfig = [
        'SilvertipSoftware\LaravelTraitPack\UsesAlternateConnection' => [ 'connection' => 'other_db' ]
    ]
```

or within a config file, under the `database.alternateConnections` tag.

```
    'alternateConnections' => [
        'FullyQualifiedClassname' => 'other_db',
        'AnotherClassName' => 'some_other_connection'
    ]

```

Classnames are searched up the hierarchy, so just the base class name can be specified in the config file. Defaults to `null`, or the default connection name.

ValidatesTrait
--------------

[](#validatestrait)

Adds an `isValid` method to a model, with a configurable set of rules. Rules are specifed with the `rules` trait config parameter. Additional rules can be specified with the `creation_rules` parameter.

### Example

[](#example)

```
    $traitConfigs = [
        'SilvertipSoftware\LaravelTraitPack\ValidatesTrait' => [
            'rules' => [
                'name' => [ 'required', 'string', 'max:20' ],
                'age' => [ 'required', 'numeric', 'min:18' ]
            ],
            'creation_rules' => [
                'password' => [ 'required', 'string' ],
                'password_confirm' => [ 'required', 'string' ]
            ]
        ]
    ]
```

The `$model->errors` message bag is set with any validation errors.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

3840d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/181c1808871c0b143792e2a5db97971850429ff960d46ffa821a954a9aeed745?d=identicon)[info@silvertipsoftware.com](/maintainers/info@silvertipsoftware.com)

---

Top Contributors

[![aksonnic](https://avatars.githubusercontent.com/u/1252956?v=4)](https://github.com/aksonnic "aksonnic (13 commits)")

### Embed Badge

![Health badge](/badges/silvertipsoftware-laravel-trait-pack/health.svg)

```
[![Health](https://phpackages.com/badges/silvertipsoftware-laravel-trait-pack/health.svg)](https://phpackages.com/packages/silvertipsoftware-laravel-trait-pack)
```

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

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