PHPackages                             humans/laravel-setup-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. humans/laravel-setup-traits

AbandonedArchivedLibrary

humans/laravel-setup-traits
===========================

Autorun traits on PHPUnit setup.

1.1.0(5y ago)06.7k[1 issues](https://github.com/humans/laravel-setup-traits/issues)MITPHP

Since Apr 23Pushed 3y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Setup Traits
====================

[](#laravel-setup-traits)

---

**Laravel now has this built-in!**

---

This package allows traits to be ran automatically on the setup of your tests.

Here's an example.

```
class PostUpdateTest extends TestCase
{
    use ActingAsEdtior;
}

trait ActingAsEditor
{
    function setupActingAsEditor()
    {
        $this->editor = factory(User::class)->states('editor');

        $this->be($this->editor);
    }
}
```

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

[](#installation)

Require the package via composer.

```
composer require humans/laravel-setup-traits --dev

```

Use the trait in your base test case.

```
use Humans\SetupTraits\SetupTraits;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;

abstract class TestCase extends BaseTestCase
{
    use SetupTraits;
}
```

Create a trait you want with the method name `setup` + `class name`

```
use Illuminate\Support\Facades\Notification;

trait	WithoutNotifications
{
    function setupWithoutNotifications
    {
        Notification::fake();
    }
}
```

Then include the trait in any of your tests!

```
class SettingsUpdateTest extends TestCase
{
    use WithoutNotifications;
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

Total

2

Last Release

1856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/06e7a5b32f6567359142eb43dbbb6fe9165ca50e9a94f15d320f5dd2ca159b10?d=identicon)[humans](/maintainers/humans)

---

Top Contributors

[![jaggy](https://avatars.githubusercontent.com/u/1993075?v=4)](https://github.com/jaggy "jaggy (3 commits)")

### Embed Badge

![Health badge](/badges/humans-laravel-setup-traits/health.svg)

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

PHPackages © 2026

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