Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Useful Bundle Laravel Package

skobkin/useful-bundle

skobkin/useful-bundle is a Symfony bundle that gathers reusable helpers and utilities for PHP projects. It offers a lightweight way to share common functionality and reduce boilerplate across applications, with simple Composer installation.

View on GitHub
Deep Wiki
Context7

Getting Started

First, verify what you are actually installing. This is a Symfony 2 bundle (Bundle subclass, XML/YAML DI config, Symfony Form/Twig/Doctrine extension points), not a Laravel package. There is no service provider, no facade, no config/*.php to publish, and no extra.laravel block. Before any composer command, open composer.json in the repo and read the symfony/*, twig/twig, and doctrine/* constraints — those tell you which framework generation the code targets and whether it can coexist with your tree at all.

Minimal steps for the two realistic scenarios:

  • Legacy Symfony 2 app (the only drop-in case). composer require skobkin/useful-bundle pinned to a commit, register new Shtumi\UsefulBundle\ShtumiUsefulBundle() in app/AppKernel.php, then php app/console container:debug | grep shtumi to see what services you actually got. First use case: a date-range form field on an admin filter form.
  • Laravel app (the likely case). Do not composer require. Clone the repo, open src/ and the Resources/config/ service definitions, and read the three families of classes: form types, Doctrine FunctionNode subclasses, Twig extensions. Pick the one capability you need and port it into app/Support/. Composer install into a modern Laravel app will resolve into a deadlock against Symfony 6/7, so don't spend an afternoon discovering that.

Where to look first, in order: composer.json (compatibility reality check) → DependencyInjection/ (what is configurable, what service ids exist) → the form types / DQL functions / Twig extensions themselves (the actual value). The DI plumbing is disposable; the algorithms are what you're here for.

Implementation Patterns

Legacy Symfony 2 — container-first usage. The bundle exposes services by id; you inject them rather than instantiating. The pattern is always the same: define the form type as a service argument, tag Twig extensions with twig.extension, and register DQL functions under doctrine.orm.entity_managers.*.dql.DQL or globally via doctrine.orm.dql. Typical day-to-day wiring:

# app/config/config.yml
doctrine:
    orm:
        dql:
            string_functions:
                DATE: Shtumi\UsefulBundle\DQL\DateFunction
// controller
$form = $this->createForm(DateRangeType::class, null, [
    'field_options' => ['widget' => 'single_text'],
]);

Laravel — port by capability, not by package. Each slice of the bundle lands in a different part of your app, and none of them land as a dependency:

  • DQL functions are only relevant if you deliberately run Doctrine ORM under Laravel. Port as first-party FunctionNode subclasses and register them in your own Doctrine config. Write a test that asserts the generated SQL string — that is the only defense against a silently wrong FunctionNode.
  • Form types (date range, dependent/autocomplete selects) become a Blade component plus a FormRequest for validation, with a small Alpine/Livewire wrapper if the widget is interactive. Keep the option-resolution logic (defaults, setDefaultOptions-era behavior) — it is the part people get wrong when hand-rolling.
  • Twig extensions become Blade directives, a view composer, or plain helper functions in app/Support. Port only the pure string/date functions; discard the Twig_Extension registration boilerplate.

Workflow that works. Treat the repo as a spec: (1) inventory every class as reusable logic, framework plumbing, or dead weight; (2) confirm a current feature actually needs it; (3) port the smallest useful unit with tests; (4) keep it in first-party code under your own CI. Time-box the whole thing — for most single helpers this is an hour, not a sprint.

Gotchas and Tips

  • API drift is the main hazard. Expect Twig 1 Twig_Extension base classes, Symfony 2 Form getName()/setDefaultOptions() lifecycle (removed in favor of configureOptions() in 2.7+), and older Doctrine FunctionNode constructor signatures. Any file you copy needs a pass for removed functions, deprecated dynamic properties (8.2), and implicit nullable parameters.
  • DQL functions fail silently. A subtly wrong FunctionNode produces valid-but-incorrect SQL — wrong date bucketing, wrong null handling — that passes code review and shows up as bad reporting data weeks later. Never let a ported DQL function sit in a correctness-critical path without an SQL-string assertion test.
  • The bundle has zero adoption (0 stars, 0 dependents). There is no issue history, no Stack Overflow corpus, no Dependabot remediation path — you are the sole QA function for code you didn't write. That argues for copying the logic (with license/attribution confirmed) rather than depending on the artifact.
  • License and provenance are unverified. This is a fork of an older bundle; confirm attribution and redistribution terms before copying a single method. Record the source commit and license in a comment above the ported code.
  • Config is the bundle's own, not Symfony Flex. There is no recipe, no config/packages/*.yaml skeleton, no env-var interpolation. Read Configuration.php to see the real keys; don't guess from the README.
  • Debugging the container in the legacy scenario: console container:debug, then container:debug <service_id> to confirm arguments resolved. Most "it's not working" reports are a missing tag (twig.extension) or a service not being public.
  • Extension points worth reading rather than owning: the compiler pass / service-definition pattern is textbook and worth copying into your own bundle if you ever ship one — but do not inherit its coupling of forms, DQL, and Twig into a single upgrade decision. Split anything you port into appropriately narrow first-party modules.
  • Never add this to composer.json in a Laravel app. If you need the behavior, you own the code; there is no maintainer to escalate to and no release cadence to track.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core