PHPackages                             proklung/framework-tools-bundle - 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. proklung/framework-tools-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

proklung/framework-tools-bundle
===============================

Misc tools for custom Symfony.

1.5.5(4y ago)131MITPHPPHP &gt;=7.3 || ^8.0

Since May 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ProklUng/framework-tools-bundle)[ Packagist](https://packagist.org/packages/proklung/framework-tools-bundle)[ RSS](/packages/proklung-framework-tools-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (18)Versions (44)Used By (1)

Различные дополнительные инструменты для кастомных вариантов Symfony
====================================================================

[](#различные-дополнительные-инструменты-для-кастомных-вариантов-symfony)

Установка
---------

[](#установка)

1. composer.json:

```
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/proklung/framework-tools-bundle"
    }
  ]
```

2. `composer require proklung/framework-tools-bundle`

Детали
------

[](#детали)

### Delayed event dispatcher

[](#delayed-event-dispatcher)

[Основа](https://github.com/olvlvl/delayed-event-dispatcher/blob/master/README.md)

Из особо интересного: "Flushing delayed events with a custom flusher".

Если запускается из под Битрикс, то подвязывается слушатель на событие `OnEpilog`.

Если запускается из под Wordpress, то подвязывается слушатель на хук `shutdown`.

### Command runner

[](#command-runner)

Форк [пакета](https://github.com/Fichtme/symfony-command-runner). Запуск команд пакетом в разных процессах.

#### Пример использования

[](#пример-использования)

```
(new CommandRunner([
            new Process("my:command -q"),
            new Process("my:command2 -q"),
            new Process("my:command3 -q").
            new Process("my:command4 -q"),
            new Process("my:command5 -q"),
            new Process("my:command6 -q --env=$env"),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();

```

Как-то так:

```
class ExampleRunner extends Command
{
    /** @var SymfonyStyle */
    protected $io;

    /**
     * @inheritDoc
     */
    protected function configure()
    {
        $this->setName('runner:example')
             ->setDescription('runner example');
    }

    /**
     * @inheritDoc
     */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new SymfonyStyle($input, $output);

        $this->io->writeln('Running runner example');

        sleep(5); # Sleep so user can abort update

        (new CommandRunner([
            new Process(['cache:clear', 'cache:clear --cache-type menu']),
        ]))
            ->continueOnError(true)
            ->setIO($this->io)
            ->setLimit(3)
            ->run();

        return 0;
    }
}
```

### Lockable консольные команды

[](#lockable-консольные-команды)

Команды, запускающиеся одновременно только в одном экземпляре.

```
use Prokl\FrameworkExtensionBundle\Services\Command\Lockable\AbstractLockableCommand;

class SomeCommand extends AbstractLockableCommand
{
   protected function configure()
   {
       $this->setName('lock:command')
            ->setDescription('Lock command')

       ;

       parent::configure();
   }

   protected function execute(InputInterface $input, OutputInterface $output) : int
   {
        $output->writeln('Start');
        sleep(100);
        $output->writeln('End');

        return 0;
   }
}
```

Можно отнаследовать метод `getLockTtl()`, чтобы переопределить время блокировки (по умолчанию - 60 секунд).

Зависимости такого сорта команд подцепляются через сеттеры посредством механизма autowiring.

### Консольные команды

[](#консольные-команды)

#### Очистка кэша (Битрикс и Wordpress)

[](#очистка-кэша-битрикс-и-wordpress)

```
php bin/console cache:clear
```

### Простой битриксовый PSR-16 кэш

[](#простой-битриксовый-psr-16-кэш)

```
  bitrix.simple.cacher.configured:
    class: Prokl\FrameworkExtensionBundle\Services\Bitrix\Psr16Cache\BitrixCacher
    arguments: ['@Bitrix\Main\Data\Cache']
    calls:
      - setBaseDir: ['/guzzle_request']
      - setTtl: [3600]
```

Методы:

- **get**
- **getMultiple**
- **has**
- **delete**
- **deleteMultiple**
- **clear**
- **setMultiple**
- **set** - `set($key, $value, $ttl = null)`
- **getOrSet** - `getOrSet(string $key, callable $callable, $ttl = null)`

### Кастомные валидаторы для Symfony Validator

[](#кастомные-валидаторы-для-symfony-validator)

- **Email** - при помощи `Egulias\EmailValidator`
- **Phone** - при помощи `giggsey/libphonenumber-for-php`

### Вспомогательное для контроллеров

[](#вспомогательное-для-контроллеров)

- `BinaryFileResponseTrait` - метод `returnFile(string $file)` отдаст в браузер BinaryFileResponse файл $file, автоматом определив contentType.

### Отправка информации о фатальных ошибках через Symfony Notifier для Wordpress

[](#отправка-информации-о-фатальных-ошибках-через-symfony-notifier-для-wordpress)

- Должна быть определена переменная среды `ADMIN_EMAIL`
- Должен быть установлен пакет `symfony/notifier` и [бандл](https://github.com/ProklUng/core.framework.extension.bundle). Если нет, то соответствующие сервисы удаляются из контейнера при компиляции.
- В корневом проекте должен быть класс-сервис, реализующий `Prokl\FrameworkExtensionBundle\Services\Wordpress\ErrorHandler\Contract\ErrorDbOperatorInterface`для работы с записями в БД (в моем случае сохраняется md5 от сериализованного исключения).
- `save` - сохранить сведения об ошибке в базу (или куда там еще).
- `has` - есть ли запись об этой ошибке в базе или нет.
- `clearTable` - очистить таблицу с данными об ошибках.
- По умолчанию сообщения засылаются в каналы, отмеченные как `urgent`.
- Декорированный логгер.

Конфиг основного проекта:

```
  logger_notify_decorated:
    class: Prokl\FrameworkExtensionBundle\Services\Wordpress\Notifier\LoggerDecorator
    decorates: 'logger'
    arguments: ['@.inner', '@wp_notificator']
```

### Логгирование SQL запросов для Wordpress посредством Monolog

[](#логгирование-sql-запросов-для-wordpress-посредством-monolog)

Сервис `sql.logger.monolog`. Если в контейнере нет сервисов `wpdb` (экземпляр wpdb) и `logger` - логгер удаляется.

В `wp-config.php`:

```
define('SAVEQUERIES', true);
```

Но я сделал так (`SAVEQUERIES` в `.env` =&gt; 0 или 1):

```
define('SAVEQUERIES', (bool)$_ENV['SAVEQUERIES'] ?? false);
```

Где-нибудь:

```
$sql = container()->get('sql.logger.monolog');
$sql->init();
```

Лог запросов упадет в обычный лог Монолога.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

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

Total

43

Last Release

1728d ago

PHP version history (2 changes)1.0.1PHP &gt;=7.3

1.5.3PHP &gt;=7.3 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9210c86ee6734e537eaf22c0f2fe7a965451e340e39e1aae2b74013f24c2660d?d=identicon)[gedovan](/maintainers/gedovan)

---

Top Contributors

[![ProklUng](https://avatars.githubusercontent.com/u/19857467?v=4)](https://github.com/ProklUng "ProklUng (49 commits)")

---

Tags

bitrixbitrix-symfonyphp7symfony-bundlewordpresswordpress-symfony

### Embed Badge

![Health badge](/badges/proklung-framework-tools-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/proklung-framework-tools-bundle/health.svg)](https://phpackages.com/packages/proklung-framework-tools-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[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)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)

PHPackages © 2026

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