PHPackages                             spacegrass/bareback - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. spacegrass/bareback

ActiveLibrary[Testing &amp; Quality](/categories/testing)

spacegrass/bareback
===================

Selectively use the Laravel framework when running tests

0.2(6y ago)147[3 PRs](https://github.com/dallincoons/laravel-bareback/pulls)MITPHP

Since Apr 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dallincoons/laravel-bareback)[ Packagist](https://packagist.org/packages/spacegrass/bareback)[ RSS](/packages/spacegrass-bareback/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

[![Bareback - selectively turn off Laravel in your test suite](bareback-cover.png)](bareback-cover.png)

Bareback
========

[](#bareback)

Bareback is a Laravel package that makes it easy to selectively choose which tests run with the framework loaded.

### Why would I want to run tests without the framework?

[](#why-would-i-want-to-run-tests-without-the-framework)

Running tests without loading the Laravel framework is much faster, typically anywhere from 50% to 70%. It's often a good idea to try and implement core business logic with as little dependencies as possible. However, creating an entire test suite for an application with no with no framework dependencies isn't practical or pragmatic. This package allows you to switch off the framework when testing core business logic in "unit" tests, and switch it on when running end to end or "integration" tests.

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

[](#installation)

```
composer require "spacegrass/bareback"
```

Usage
-----

[](#usage)

First you need to extend the base TestCase, which in turn extends the Laravel TestCase:

```
use Spacegrass\Bareback\TestCase as BaseTestCase;

class TestCase extends BaseTestCase
{
    //
}
```

To stop the framework from loading, simply add the `@withoutFramework` annotation to your test method:

```
/**
* @withoutFramework
*/
public function test_something_quickly()
{
    //
}
```

or alternatively, add the annotation to the class itself, and every test method therein will not load the framework by default. If you would like to turn on the framework, add the `@withFramework` annotation to any test method, and it that test method alone will load the framework.

```
/**
* @withoutFramework
*/
class FastTests extends TestCase
{
    public function test_something_without_framework_by_default()
    {
        //
    }

    /**
    * @withFramework
    */
    public function test_something_with_the_framework_for_some_reason()
    {
        //
    }
}]
```

You can add set up specifically for when the framework is loaded or not loaded by adding the `noFrameworkSetup` and `frameworkSetup` methods to your test case.

```
class SometimesRunningWithFrameworkTestCase extends TestCase
{
   public function noFrameworkSetup()
   {
       // register fake repositories or mock something out, for example
   }

   public function frameworkSetup()
   {
       // perhaps add something specific to your database migrations or anything else
       // the is dependent on the framework
    }
```

If you wish to run all your tests without the framework by default, and force an 'opt-in' approach when running tests with the framework, simply add the `withFramework` property:

```
class RunTestsWithoutFrameworkByDefaultTestCase extends TestCase
{

    protected $withFramework = false;

    public function test_runs_with_out_framework()
    {
        //
    }

    /**
    * @withFramework
    */
    public function test_requires_opt_in_to_use_framework
    {
        //
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

2227d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eeb49000a25287739988f7738dc10fabe0db8acf4ec807a0a5e997f5ba3f5d97?d=identicon)[dallinc](/maintainers/dallinc)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spacegrass-bareback/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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