PHPackages                             symplify/package-builder - 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. [CLI &amp; Console](/categories/cli)
4. /
5. symplify/package-builder

Abandoned → custom codeArchivedLibrary[CLI &amp; Console](/categories/cli)

symplify/package-builder
========================

Dependency Injection, Console and Kernel toolkit for Symplify packages.

11.3.2(3y ago)16514.5M↓15.1%720MITPHPPHP &gt;=8.1

Since Mar 1Pushed 2y ago2 watchersCompare

[ Source](https://github.com/deprecated-packages/package-builder)[ Packagist](https://packagist.org/packages/symplify/package-builder)[ Fund](https://www.paypal.me/rectorphp)[ GitHub Sponsors](https://github.com/tomasvotruba)[ RSS](/packages/symplify-package-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (17)Versions (645)Used By (20)

Package Builder
===============

[](#package-builder)

[![Downloads total](https://camo.githubusercontent.com/9ccf1f2f5c4dcaa99177dbba842c200a1ccb828f8ee748104419bf898e91ab8e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d706c6966792f7061636b6167652d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symplify/package-builder/stats)

This tools helps you with Collectors in DependencyInjection, Console shortcuts, ParameterProvider as service and many more.

Install
-------

[](#install)

```
composer require symplify/package-builder
```

Use
---

[](#use)

### Get All Parameters via Service

[](#get-all-parameters-via-service)

1. Register `ParameterProvider` service in your config:

```
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\PackageBuilder\Parameter\ParameterProvider;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->defaults()
        ->autowire()
        ->autoconfigure();

    $services->set(ParameterProvider::class)
        ->args([service('service_container')]);

    $parameter = $containerConfigurator->parameters();
    // will be used later
    $parameter->set('source', 'src');
};
```

2. Require `ParameterProvider` in `__construct()` where needed:

```
namespace App\Configuration;

use Symplify\PackageBuilder\Parameter\ParameterProvider;

final class ProjectConfiguration
{
    /**
     * @var ParameterProvider
     */
    private $parameterProvider;

    public function __construct(ParameterProvider $parameterProvider)
    {
        $this->parameterProvider = $parameterProvider;
    }

    public function getSource(): string
    {
        // returns "src"
        return $this->parameterProvider->provideParameter('source');

        // use specific typed method to avoid `mixed`
        return $this->parameterProvider->provideStringParameter('source');
    }
}
```

### Get Vendor Directory from Anywhere

[](#get-vendor-directory-from-anywhere)

```
use Symplify\PackageBuilder\Composer\VendorDirProvider;

$vendorDirProvider = new VendorDirProvider();
// returns path to vendor directory
$vendorDirProvider->provide();
```

### Smart Compiler Passes for Lazy Programmers ↓

[](#smart-compiler-passes-for-lazy-programmers-)

[How to add compiler pass](https://symfony.com/doc/current/service_container/compiler_passes.html#working-with-compiler-passes-in-bundles)?

### Always Autowire this Type

[](#always-autowire-this-type)

Do you want to allow users to register services without worrying about autowiring? After all, they might forget it and that would break their code. Set types to always autowire:

```
namespace App;

use PhpCsFixer\Fixer\FixerInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symplify\PackageBuilder\DependencyInjection\CompilerPass\AutowireInterfacesCompilerPass;

final class AppKernel extends Kernel
{
    protected function build(ContainerBuilder $containerBuilder): void
    {
        $containerBuilder->addCompilerPass(new AutowireInterfacesCompilerPass([FixerInterface::class]));
    }
}
```

This will make sure, that `PhpCsFixer\Fixer\FixerInterface` instances are always autowired.

That's all :)

### Show Diff in Console Colors

[](#show-diff-in-console-colors)

```
use Symplify\PackageBuilder\Console\Output\ConsoleDiffer;

final class SomeCommand
{
    public function __construct(
        private ConsoleDiffer $consoleDiffer
    ) {
    }

    public function run(): void
    {
        // prints colored diff to the console output
        $this->consoleDiffer->diff('oldContent', 'newContent');
    }
}
```

Report Issues
-------------

[](#report-issues)

In case you are experiencing a bug or want to request a new feature head over to the [Symplify monorepo issue tracker](https://github.com/symplify/symplify/issues)

Contribute
----------

[](#contribute)

The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on [symplify/symplify](https://github.com/symplify/symplify).

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity60

Solid adoption and visibility

Community32

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.5% 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 ~3 days

Total

644

Last Release

1181d ago

Major Versions

v6.1.0 → v7.0.02019-11-23

v7.3.14 → v8.0.0-beta12020-05-16

8.3.48 → 9.0.0-BETA12020-11-14

9.4.70 → 10.0.0-beta12021-11-02

10.3.3 → 11.0.02022-06-13

PHP version history (7 changes)v1.4.3PHP ^7.1

v7.0.0PHP ^7.2

8.2.17PHP ^7.2|^8.0

8.3.0PHP &gt;=7.2

9.0.0-rc1PHP &gt;=7.3

v9.3.27PHP &gt;=8.0

11.1.11PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (476 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (33 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (13 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (3 commits)")[![janatjak](https://avatars.githubusercontent.com/u/11320085?v=4)](https://github.com/janatjak "janatjak (1 commits)")

---

Tags

consoledependency-injectionphp71symfony

###  Code Quality

TestsPHPUnit

Static AnalysisRector

Code StyleECS

### Embed Badge

![Health badge](/badges/symplify-package-builder/health.svg)

```
[![Health](https://phpackages.com/badges/symplify-package-builder/health.svg)](https://phpackages.com/packages/symplify-package-builder)
```

###  Alternatives

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

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

9.0k15.4k](/packages/prestashop-prestashop)[worksome/graphlint

A static analysis tool for GraphQL

13189.4k](/packages/worksome-graphlint)

PHPackages © 2026

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