PHPackages                             tobento/service-booting - 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. tobento/service-booting

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

tobento/service-booting
=======================

Booting manager for creating PHP applications.

2.0(7mo ago)02871MITPHPPHP &gt;=8.4

Since Jan 4Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/tobento-ch/service-booting)[ Packagist](https://packagist.org/packages/tobento/service-booting)[ Docs](https://www.tobento.ch)[ RSS](/packages/tobento-service-booting/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (7)Dependencies (7)Versions (9)Used By (1)

Booting Service
===============

[](#booting-service)

Booting for any PHP applications.

Table of Contents
-----------------

[](#table-of-contents)

- [Getting started](#getting-started)
    - [Requirements](#requirements)
    - [Highlights](#highlights)
- [Documentation](#documentation)
    - [Booter](#booter)
        - [Create Booter](#create-booter)
        - [Register Boots](#register-boots)
        - [Booting](#booting)
        - [Misc](#misc)
    - [Boots](#boots)
        - [Create Boot](#create-boot)
        - [Dependent Boot](#dependent-boot)
        - [Boot Priority](#boot-priority)
        - [Rebooting](#rebooting)
        - [Boot Info](#boot-info)
- [Credits](#credits)

---

Getting started
===============

[](#getting-started)

Add the latest version of the booting service project running this command.

```
composer require tobento/service-booting

```

Requirements
------------

[](#requirements)

- PHP 8.4 or greater

Highlights
----------

[](#highlights)

- Framework-agnostic, will work with any project
- Decoupled design

Documentation
=============

[](#documentation)

Booter
------

[](#booter)

### Create Booter

[](#create-booter)

```
use Tobento\Service\Booting\Booter;
use Tobento\Service\Booting\BooterInterface;
use Tobento\Service\Booting\AutowiringBootFactory;
use Tobento\Service\Container\Container;

// Any PSR-11 container
$container = new Container();

$booter = new Booter(
    bootFactory: new AutowiringBootFactory($container),
    name: 'app',
    bootMethods: ['register', 'boot'],
    terminateMethods: ['terminate'],
);

var_dump($booter instanceof BooterInterface);
// bool(true)
```

**Parameters explanation**

ParameterDescription**bootFactory**The boot factory.**name**The name of the booter.**bootMethods**The boot methods the booter calls if exists, in the order defined.**terminateMethods**The terminate methods the booter calls if exists, in the order defined.### Register Boots

[](#register-boots)

Each boot class is registered once. If you register the same class again it will just overwrite it.

```
$booter->register(new ConfigBoot());

// You may set a priority for the boot:
$booter->register(DebugBoot::class, priority: 2000);

$booter->register(
    HttpBoot::class,
    RoutingBoot::class,
);
```

### Booting

[](#booting)

```
// calls the boot methods:
$booter->boot();

// calls the terminate methods
$booter->terminate();
```

You may call the booting methods as many times as you want. By default the boot methods gets called once, except declared otherwise with the constant **REBOOTABLE** in the boot classes. See [Rebooting](#rebooting).

**Example**

```
$booter->register(ConfigBoot::class);

$booter->register(DebugBoot::class, priority: 2000);

$booter->register(
    HttpBoot::class,
    RoutingBoot::class,
);

$booter->boot();
$booter->terminate();

/*
boot: DebugBoot::class
boot: ConfigBoot::class
boot: HttpBoot::class
boot: RoutingBoot::class
terminate: RoutingBoot::class
terminate: HttpBoot::class
terminate: ConfigBoot::class
terminate: DebugBoot::class
*/
```

### Misc

[](#misc)

**get**

Returns the specified boot registry if exist, otherwise NULL.

```
use Tobento\Service\Booting\BootRegistry;

$boot = $booter->get(MyBoot::class);

var_dump($boot instanceof BootRegistry);
// bool(true)
```

**getBoot**

Returns the specified boot if exist, otherwise NULL.

```
use Tobento\Service\Booting\BootInterface;

$boot = $booter->getBoot(MyBoot::class);

var_dump($boot instanceof BootInterface);
// bool(true)
```

**getBoots**

Returns the registered boots.

```
use Tobento\Service\Booting\BootRegistry;

$boots = $booter->getBoots();

foreach($boots as $boot) {
    var_dump($boot instanceof BootRegistry);
    // bool(true)
}
```

**getBooted**

For debugging purposes, you might want to get boots booted.

```
$booted = $booter->getBooted();
```

Boots
-----

[](#boots)

### Create Boot

[](#create-boot)

You can create a Boot by simply exenting Tobento\\Service\\Booting\\Boot:

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    //
}
```

Currently, your Boot doesn't do anything. Depending on the booter **boot** and **terminate** methods defined, you can now define these methods in your Boot class which support method injection (autowiring).

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    public function boot(): void
    {
        // Do something
    }

    public function terminate(): void
    {
        // Do something
    }
}
```

### Dependent Boot

[](#dependent-boot)

If your Boot depends on another Boot you may ensure that the Boot has always been initiated before by using the constant **BOOT**.

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    public const BOOT = [
        AnotherBoot::class,
    ];

    public function boot(AnotherBoot $boot): void
    {
        // Do something
    }
}
```

### Boot Priority

[](#boot-priority)

You may declare a boot priority by using the constant **PRIORITY**. The default priority is 1000.

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    public const PRIORITY = 2000;
}
```

### Rebooting

[](#rebooting)

By default, when the booter calls the [Booting](#booting) methods muliple times, the boot method gets call once only. You may define methods as rebootable by using the constant **REBOOTABLE**.

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    public const REBOOTABLE = ['terminate'];
}
```

### Boot Info

[](#boot-info)

You may add some info for your boot methods by using the constant **INFO**.

```
use Tobento\Service\Booting\Boot;

class MyBoot extends Boot
{
    public const INFO = [
        'boot' => 'Some description what the boot method does.',
        'terminate' => 'Some description what the terminate method does.',
    ];
}
```

Credits
=======

[](#credits)

- [Tobias Strub](https://www.tobento.ch)
- [All Contributors](../../contributors)

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance67

Regular maintenance activity

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

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

Recently: every ~204 days

Total

9

Last Release

227d ago

Major Versions

1.x-dev → 2.02025-09-24

PHP version history (2 changes)1.0.0PHP &gt;=8.0

2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/055d6a1b5c2384bb179c75ab0b55914231d898fdc4dffeb30770f81200e52206?d=identicon)[TOBENTOch](/maintainers/TOBENTOch)

---

Top Contributors

[![tobento-ch](https://avatars.githubusercontent.com/u/16684832?v=4)](https://github.com/tobento-ch "tobento-ch (11 commits)")

---

Tags

packagetobentobootingbooter

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tobento-service-booting/health.svg)

```
[![Health](https://phpackages.com/badges/tobento-service-booting/health.svg)](https://phpackages.com/packages/tobento-service-booting)
```

PHPackages © 2026

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