PHPackages                             leadtech/boot-framework - 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. [Framework](/categories/framework)
4. /
5. leadtech/boot-framework

ActiveLibrary[Framework](/categories/framework)

leadtech/boot-framework
=======================

Minimalistic implementation of the symfony service container to provide advanced and IoC capabilities to light weight applications.

v3.3.8(8y ago)742MITPHPPHP &gt;=7.1

Since Oct 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Leadtech/BootFramework)[ Packagist](https://packagist.org/packages/leadtech/boot-framework)[ RSS](/packages/leadtech-boot-framework/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (17)Versions (8)Used By (0)

**[Examples](#examples)**| **[Installation](#installation)**| **[Versioning](#versioning)**| **[Improvements](#improvements)**| **[Contribute](#contribute)**| **[License](#license)**

[![Build Status](https://camo.githubusercontent.com/8690c5293f76ae66c9a2cf486c80e28ae71a9d89698be5ab6fffe18b37697503/68747470733a2f2f7472617669732d63692e6f72672f4c656164746563682f426f6f744672616d65776f726b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Leadtech/BootFramework)[![Code Climate](https://camo.githubusercontent.com/975958cc7dcbb69f9fd3145ab707e0f0913ffae1035fe4c6f5c57e8930d7a3ba/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4c656164746563682f426f6f744672616d65776f726b2f6261646765732f6770612e737667)](https://codeclimate.com/github/Leadtech/BootFramework)[![Test Coverage](https://camo.githubusercontent.com/99bf713072b1b0b6d8adc0ff3bd1dc5d9c21721486dccd05f80d22bc56eadc01/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4c656164746563682f426f6f744672616d65776f726b2f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Leadtech/BootFramework/coverage)[![License](https://camo.githubusercontent.com/74ea3d774c5103e6783dc09d57ef2525e1ddb80fee772cd83c2f766cf7e62e78/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/74ea3d774c5103e6783dc09d57ef2525e1ddb80fee772cd83c2f766cf7e62e78/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)[![PHP](https://camo.githubusercontent.com/0eb871f4c369e0f5b88f49df6fad2cb30df935c96ae2e8168cd138ef7f415dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e312d626c75652e737667)](https://camo.githubusercontent.com/0eb871f4c369e0f5b88f49df6fad2cb30df935c96ae2e8168cd138ef7f415dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d2533453d372e312d626c75652e737667)[![Platform](https://camo.githubusercontent.com/7ccc10500a622b7b384a687b26243c70ee7b20a0700bba9585e481249be93334/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d57696e646f7773253230253743253230694f532532302537432532304c696e7578253230253743253230556e69782d6c69676874677265792e737667)](https://camo.githubusercontent.com/7ccc10500a622b7b384a687b26243c70ee7b20a0700bba9585e481249be93334/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d57696e646f7773253230253743253230694f532532302537432532304c696e7578253230253743253230556e69782d6c69676874677265792e737667)

Boot Framework
==============

[](#boot-framework)

Boot is a **minimalistic** framework designed with simplicity and flexibility in mind. This framework is primarily intended for **API's**/**micro services** or **console applications**.

Getting started
---------------

[](#getting-started)

The goal is to provide a micro framework that is fast, flexible but without sacrificing *most* of the useful functionality that Symfony offers to develop well designed and maintainable applications. Boot is a micro framework that is build on the components that Symfony developers know and love. Boot is designed with speed and efficiency in mind. But the main goal of this framework is not to become *the fastest* framework. The main goal is to provide a minimalistic framework to help shape well designed PHP applications and to increase productivity. Boot is highly extensible which makes it easy to fit the framework to your needs. To wire the application use *or extend* one of the *Builder* classes to configure and build your application. For examples please go to the [examples](#examples) section or go to the examples directory.

### Features

[](#features)

- Clean and flexible bootstrap
- Integrates Symfony Config
- Integrates Symfony Dependency Injection
- Integrates Symfony Event Dispatcher
- Integrates Symfony Console (optional)
- Integrates Symfony Http Foundation (optional)
- Integrates Symfony Router (optional)

[⬆️](#top)

Examples
--------

[](#examples)

Examples:

- Example 1: Basic Application
- Example 2: Boot Micro Service
- Example 3: Boot Console Application

**For full usage examples check out the examples folder.**

### Example 1: Basic Application

[](#example-1-basic-application)

#### Bootstrapping the application

[](#bootstrapping-the-application)

```
// Build application
$rootDir = realpath(__DIR__ . '/..');
$app = (new \Boot\Builder($rootDir))
    ->appName('BasicApplication')
    ->optimize('tmp/cache')
    ->environment(Boot::PRODUCTION)
    ->configDir('resources/config')
    ->build()
;

$service = $app->get('my-service');
$service->doSomething();
```

#### Configure service container

[](#configure-service-container)

```

```

### Example 2: Boot Micro Service

[](#example-2-boot-micro-service)

#### Bootstrapping the application

[](#bootstrapping-the-application-1)

```
$app = (new \Boot\Http\WebBuilder($rootDir))

    // Set application name
    ->appName('SimpleMicroService')

    // Set version
    ->appVersion('1.0.0')

    // The service ID for the HTTP service, defaults to 'http'
    ->httpServiceIdentifier('http')

    // Optimize performance by compiling the resolved state of the service container and routing configuration.
    // The framework will generate highly optimized classes to provide the same context. Only faster :-)
    // This optimization is ny default ignored in any other environment than production.
    ->optimize('tmp/cache')

    // Sets the environment (the environment
    ->environment(Boot::DEVELOPMENT)

    // Add path to a config directory
    ->configDir('../../shared/config')

    // Add path to another config directory
    ->configDir('resources/config')

    // Add a parameter (available in the service container as %project_dir% and can be injected to other services)
    ->parameter('project_dir', $rootDir)

    // Sets default values for route parameters
    ->defaultRouteParams(['countryCode' => 'NL'])

    // Sets default constraints for route parameters
    ->defaultRouteRequirements(['countryCode' => 'US|EN|FR|NL'])

    // Register endpoint to get employees
    ->get('employees/{countryCode}', EmployeeService::class, 'all', new RouteOptions(
        'all-employees'
    ))

    // Register endpoint to create a new employee
    ->post('employees/{countryCode}', EmployeeService::class, 'create', new RouteOptions(
        'create-employee'
    ))

    // Register endpoint to update an employee
    ->put('employees/{countryCode}', EmployeeService::class, 'update', new RouteOptions(
        'update-employee'
    ))

    // Register endpoint to delete an employee
    ->delete('employees/{countryCode}', EmployeeService::class, 'create', new RouteOptions(
        'delete-employee'
    ))

    ->build()
;

// Handle HTTP request
$app->run();
// is equivalent to: $app->get($builder->getHttpServiceIdentifier())->handle(Request::createFromGlobals());
```

#### Micro-service Implementation

[](#micro-service-implementation)

Although services in boot are very similar to controllers. I chose to use a different terminology for Boot. Controllers are typical to MVC frameworks. If feel like the term 'controller' usually implies an architecture in which a single controller is one amongst many. In order to emphasize the intended purpose of this framework to use it for micro-services / API's I felt like it would be more appropriate to call them Services.

```
class EmployeeService extends AbstractService
{
    /**
     * Returns all employees
     *
     * @return array               Arrays or instances of JsonSerializable are automatically encoded as json
     */
    public function all()
    {
        // For demo purposes:
        // echo $this->getServiceContainer()->get('blaat');
        // print_r($this->getRouteMatch()->getRouteParams());
        // $request = $this->getRequest();

        return [
            ['id' => 1, 'firstName' => 'Jan', 'lastName' => 'Bakker', 'age' => 30],
            ['id' => 2, 'firstName' => 'Ben', 'lastName' => 'Gootmaker', 'age' => 32],
        ];
    }

    /**
     * Update an employee
     *
     * @return string              A textual response is outputted as is
     */
    public function update()
    {
        return __METHOD__;
    }

    /**
     * This method will delete an employee and send a 201 Accepted on success.
     *
     * @return Response           A regular symfony response object
     */
    public function delete()
    {
        return Response::create('ACCEPTED', 201);
    }

    /**
     * This method will add an employee and send a 201 Accepted on success.
     *
     * @return Response           A regular symfony response object
     */
    public function create()
    {
        return Response::create('ACCEPTED', 201);
    }

}
```

### Example 3: Boot Console Application

[](#example-3-boot-console-application)

#### Bootstrapping the application

[](#bootstrapping-the-application-2)

```
// Build application
$rootDir = realpath(__DIR__ . '/..');
$app = (new \Boot\Console\ConsoleBuilder($rootDir))
    ->appName('SimpleConsoleApplication')
    ->optimize('tmp/cache')
    ->environment(Boot::PRODUCTION)
    ->configDir('resources/config')
    ->configDir('src/MyPackage/resources/config')
    ->parameter('project_dir', $rootDir)
    ->parameter('some_other_variable', 123)
    ->consoleServiceIdentifier('my_custom_console_id')
    ->build()
;

// Run the application
$app->run();
```

#### Configure service container

[](#configure-service-container-1)

```

    hello:world

```

[⬆️](#top)

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

[](#installation)

### Dependencies

[](#dependencies)

To get started you will need to install composer. I will assume you have composer installed or know how to do it. Otherwise go to  and follow the steps needed to install composer.

### Composer

[](#composer)

#### Add dependency to composer.json

[](#add-dependency-to-composerjson)

*For PHP 5.5, 5.6 and 7.0*

```
{
    "require": {
        "leadtech/boot-framework": "2.8.*"
    }
}
```

*For PHP &gt;= 7.1*

```
{
    "require": {
        "leadtech/boot-framework": "3.3.*"
    }
}
```

#### Install dependencies

[](#install-dependencies)

```
$ php composer.phar install
```

Compatibility
-------------

[](#compatibility)

To ensure compatibility with applications build on Symfony and to minimize the required maintainance efforts I chose not to extend any of the Symfony components. With boot I wanted to be able to cut them loose, discard all logic that was not required to implement the component and finally provide a way to wire them up. Symfony compiles the router and the dependency injection container to generate highly optimized classes to be used in production. Boot fully supports both optimizations.

[⬆️](#top)

Versioning
----------

[](#versioning)

The goal is to support (at least) every Symfony LTS version that is still maintained by Symfony. The major and minor release numbers of stable Boot framework releases reflects the Symfony release that Boot is build on. *Boot Framework 2.8.0 has been developed against Symfony 2.8.9.*.

[⬆️](#top)

Improvements
------------

[](#improvements)

### Prepare for next LTS release (Symfony 3.2)

[](#prepare-for-next-lts-release-symfony-32)

- Assess the impact of the changes in the next LTS release

### Roadmap

[](#roadmap)

- More code examples -/ starter projects
- 100% code coverage
- Add console command to the clear the cache
- Add console command to print all routes to the console
- Improve doc blocks
- Integrate php-cs-fixer in travis

### Wishlist...

[](#wishlist)

- Add new features targeted towards developing API's (e.g. generate api docs, support for swagger etc)
- Add support for distributed tracing

### Caveats

[](#caveats)

- At this time only the XML configuration format is supported. Personally, I prefer XML. But the others can be implemented in the future.

Contribute
----------

[](#contribute)

Contributions to Boot Framework are welcome.

### Issues

[](#issues)

Feel free to submit issues and enhancement requests.

### Contributions

[](#contributions)

For this project use a "fork-and-pull" workflow.

1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Run php-cs-fixer** to fix code style inconsistencies automatically

```
> php php-cs-fixer.phar fix src/Leadtech/Boot/NewAwesomeFeature/ --level=symfony
```

4. **Push** your work back up to your fork
5. Submit a **Pull request**

*Be sure to merge the latest from "upstream" before making a pull request.*

### Design Considerations

[](#design-considerations)

Contributions to Boot Framework are welcome. And the least I can do to show my gratitude is look at the contribution in due time. The project is not at a point yet to think about an extensive document about design considerations and coding guidelines. But if you are an early contributor please look at the current source code to get a sense of how the application is structured. If you are in doubt feel free to contact me. I will do what I can to help.

[⬆️](#top)

License
-------

[](#license)

The MIT License

Copyright (c) 2016 - Daan Biesterbos

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

3

Last Release

3214d ago

Major Versions

1.1.13 → v2.8.02016-09-03

v2.8.0 → v3.3.82017-09-11

PHP version history (3 changes)1.1.13PHP &gt;=5.4.0

v2.8.0PHP &gt;=5.5.0

v3.3.8PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3858692?v=4)[Daan Biesterbos](/maintainers/DaanBiesterbos)[@DaanBiesterbos](https://github.com/DaanBiesterbos)

---

Top Contributors

[![DaanBiesterbos](https://avatars.githubusercontent.com/u/3858692?v=4)](https://github.com/DaanBiesterbos "DaanBiesterbos (151 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/leadtech-boot-framework/health.svg)

```
[![Health](https://phpackages.com/badges/leadtech-boot-framework/health.svg)](https://phpackages.com/packages/leadtech-boot-framework)
```

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k246.0M11.1k](/packages/symfony-framework-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k55](/packages/open-dxp-opendxp)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M524](/packages/shopware-core)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M464](/packages/pimcore-pimcore)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)

PHPackages © 2026

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