PHPackages                             oblik/kirby-tester - 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. oblik/kirby-tester

Abandoned → [https://getkirby.com/docs/cookbook/setup/monolithic-plugin-setup](/?search=https%3A%2F%2Fgetkirby.com%2Fdocs%2Fcookbook%2Fsetup%2Fmonolithic-plugin-setup)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

oblik/kirby-tester
==================

Utility for loading Kirby and switching roots while testing.

1.2.1(6y ago)0762MITPHP

Since Aug 6Pushed 3y ago3 watchersCompare

[ Source](https://github.com/OblikStudio/kirby-tester)[ Packagist](https://packagist.org/packages/oblik/kirby-tester)[ RSS](/packages/oblik-kirby-tester/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (4)DependenciesVersions (5)Used By (2)

kirby-tester
============

[](#kirby-tester)

Allows you to easily write plugin tests by automatically loading Kirby and optionally changing its roots.

⚠ Deprecated!
-------------

[](#-deprecated)

You don't need a plugin to change roots. Your plugin repo could double as a test site for the plugin. Check [Monolithic Plugin Setup](https://getkirby.com/docs/cookbook/setup/monolithic-plugin-setup) for details.

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

[](#installation)

Install the package in either your plugin folder (recommended), or your site folder:

```
composer require oblik/kirby-tester --dev

```

Usage
-----

[](#usage)

The utility expects you to have the following directory setup in your plugin:

```
my-plugin
└── tests
    ├── roots
    │   ├── blueprints
    │   ├── config
    │   ├── content
    │   ├── templates
    │   └── ...
    └── bootstrap.php

```

Any valid root folders in `tests/roots` will be used as Kirby roots. If a `tests/bootstrap.php` script is found, it will be included as well after Kirby has been loaded. This is can be useful to run some initializations.

### As a plugin dependency

[](#as-a-plugin-dependency)

When installed inside your plugin's `vendor` folder, the tester will automatically figure out in which plugin it is and where the Kirby root is. It will also load Kirby (via its bootstrap script) and create a new Kirby instance based on your folder setup.

If you wish to also use the panel with the modified Kirby roots, you can change your site's *index.php* like that:

```
require 'site/plugins/my-plugin/vendor/autoload.php';
echo kirby()->render();
```

**Note:** If you also have [PHPUnit](https://phpunit.de/) installed, you can run tests right away. Since PHPUnit runs the Composer autoloader, this package will be loaded, which will also load Kirby.

### As a site dependency

[](#as-a-site-dependency)

When installed inside your site's `vendor` folder, you need to use the global `kirbytest()` function provided to you:

#### `kirbytest(string $input)`

[](#kirbyteststring-input)

- `@param $input` can be either a plugin name or a path to your *tests* folder
    - if it's a plugin name, the *tests* folder path will be `site/plugins/$input/tests`
    - if it's a relative or absolute path, it should point to the *tests* folder itself
- `@returns` a Kirby instance so and you can chain its `render()` method; returns `null` if no *tests* folder is found

In your site's *index.php*, you can use it like this:

```
require 'kirby/bootstrap.php';
echo kirbytest('my-plugin')->render();
```

### Bootstrap hooks

[](#bootstrap-hooks)

You can use `tests/bootstrap.php` to do various things at different points of the script execution by defining hooks:

```
return [
    'beforeLoad' => function () {
        echo 'before Kirby vendor autoload';
    },
    'afterLoad' => function () {
        echo 'after Kirby vendor autoload';
    },
    'beforeInit' => function () {
        echo 'before Kirby instance';
    },
    'afterInit' => function ($kirby) {
        echo 'after Kirby instance';
    }
];
```

By default, hooks are run only when PHP is running from the CLI (i.e. when tests are running). If you want them to always run, set `always` to `true` inside the configuration above.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

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

Every ~11 days

Total

4

Last Release

2481d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/078077710a1481f0419521ab1e1d3e5f93723aadd56148937ee3e355b93acb2e?d=identicon)[hdodov](/maintainers/hdodov)

---

Top Contributors

[![yandodov](https://avatars.githubusercontent.com/u/5570098?v=4)](https://github.com/yandodov "yandodov (14 commits)")

### Embed Badge

![Health badge](/badges/oblik-kirby-tester/health.svg)

```
[![Health](https://phpackages.com/badges/oblik-kirby-tester/health.svg)](https://phpackages.com/packages/oblik-kirby-tester)
```

###  Alternatives

[contao-bootstrap/bundle

Install all modules of the Contao Bootstrap extension

1147.2k2](/packages/contao-bootstrap-bundle)

PHPackages © 2026

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