lazyants/toolkit-bundle
A PHP toolkit bundle that packages reusable helpers and utilities into a single installable dependency, offering a convenient starting point for common development tasks. See the repository for included components, requirements, and usage details.
Read this first: despite the request framing this for a Laravel developer, lazyants/toolkit-bundle is a Symfony bundle, not a Laravel package. It has no service provider, no config/toolkit.php, no facade. If you are in a Laravel codebase, you cannot composer require your way to value here — treat the repo as a code-reference toolbox you copy from, not a dependency you install.
If you are in Symfony (2.x/3.x era, which is what this was built for):
composer require lazyants/toolkit-bundle
The last tagged release is 2014-04-07, so expect a dev-master fallback and a version constraint like "lazyants/toolkit-bundle": "~1.0" that may need loosening to "*@dev".// Symfony 2/3: app/AppKernel.php
public function registerBundles()
{
$bundles = [
// ...
new Lazyants\ToolkitBundle\LazyantsToolkitBundle(),
];
return $bundles;
}
// Symfony 4+/Flex: config/bundles.php
return [
Lazyants\ToolkitBundle\LazyantsToolkitBundle::class => ['all' => true],
];
There is no Flex recipe — no config/packages/lazyants_toolkit.yaml will be generated for you.DependencyInjection/Configuration.php — the complete list of knobs you can set under the lazyants_toolkit: root key. This is your table of contents.Resources/config/services.yml (or .xml) — the service IDs you can inject. Note the prefix convention; expect lazyants_toolkit.*.Resources/views/ and Twig/ — anything exposed as a Twig function/filter.Util/, Helper/, Form/, EventListener/ — the actual reusable units, which are the parts worth porting.public function __construct(\Lazyants\ToolkitBundle\Util\SomeHelper $helper) { ... }
If autowiring doesn't resolve it (it usually won't — this predates autowiring), fall back to the explicit service ID in services.yml:
app.my_controller:
class: AppBundle\Controller\MyController
arguments: ['@lazyants_toolkit.some_helper']
Laravel translation of the first use case: find the one or two classes in Util//Helper/ you actually want, copy them into app/Support/, and bind them:
// app/Providers/ToolkitServiceProvider.php
$this->app->singleton(\App\Support\Toolkit\SomeHelper::class);
That is the realistic day-to-day path for a Laravel dev touching this repo.
Configuration-driven services. The typical bundle shape here is a config tree that feeds service arguments. Configure once:
# app/config/config.yml
lazyants_toolkit:
some_option: true
other_option: ~
Then read it back in the DI extension (DependencyInjection/LazyantsToolkitExtension.php). Before using anything, run php app/console config:dump-reference lazyants_toolkit to see the real tree rather than trusting the README.
Constructor injection over container-pulling. The helpers are plain services, so prefer injecting them. If a class is stateless, alias it once in your app config so autowiring works in modern Symfony:
services:
Lazyants\ToolkitBundle\Util\SomeHelper:
alias: lazyants_toolkit.some_helper
public: true
Twig helpers. If the bundle ships a Twig extension, the pattern is registration-then-usage:
{{ some_value|toolkit_filter }}
{{ toolkit_function(arg) }}
Check Twig/ for the exact names; they are not namespaced in templates, so a collision with Symfony's own filters is a real risk (see Gotchas).
Event listener/subscriber integration. Bundles of this vintage frequently register a kernel.request or kernel.response listener by default. That means behavior changes the moment you register the bundle, before you write a line of code. Verify with:
php app/console debug:event-dispatcher kernel.request
Porting a helper into Laravel. The most common real-world workflow:
app/Support/Toolkit/.Symfony\Component\...) — usually Request, Response, Container, ParameterBag.Testing pattern. Treat the copied helpers as your own code and write characterization tests immediately — you have no upstream test suite guarantees and no maintainer to ask. For Symfony installs, a smoke test that just boots the kernel and asserts the container compiles catches most integration breakage from this bundle.
each(), create_function, non-nullable parameter deprecations, Symfony\Component\DependencyInjection\Definition API drift). On Symfony 4+, Resources/config/services.yml XML/YAML conventions and Definition::setArguments() semantics differ enough that the DI extension often needs rewriting.autowire: true will fail on them silently or at compile time. Alias the service IDs explicitly.AppKernel, templates and Twig namespaces resolve by order; register this bundle after FrameworkBundle and TwigBundle. In bundles.php, order is lexical by key in some Flex versions — don't rely on it for overrides.debug:event-dispatcher before and after registering to see exactly what it bought you.toolkit_* functions/filters can shadow app-level ones. Grep your templates for the names before enabling.config:dump-reference lazyants_toolkit and reading DependencyInjection/Configuration.php are the only reliable sources of truth.php app/console debug:container lazyants_toolkit lists the services it actually registered; php app/console lint:yaml app/config catches config typos that otherwise surface as cryptic InvalidConfigurationException.services.yml: php app/console cache:clear --env=dev. Stale container caches produce "service not found" errors that look like the bundle is broken.CompilerPass in your own bundle) and service overrides by redefining the same service ID later in the container build. Bundle inheritance (getParent()) is deprecated and not worth using.ContainerInterface or EventDispatcherInterface into Laravel's container to make the bundle "just work." Copy the two or three classes you need — it is less code and infinitely more debuggable than an adapter layer.How can I help you explore Laravel packages today?