sergeil/aux-bundle
sergeil/aux-bundle is a Laravel/PHP package that bundles auxiliary helpers and utilities for common development tasks. It is lightweight and easy to integrate, helping reduce boilerplate and keep application code organized with reusable support components.
Install with Composer and register the bundle. This is a utility bundle with no configuration file of its own, so setup is a single line plus a bundle registration. As of v1.1.3 (Symfony 5 compatibility), the package works on Symfony 4.4/5.x:
composer require sergeil/aux-bundle
// config/bundles.php (Symfony Flex / 4+)
return [
// ...
Sli\AuxBundle\SliAuxBundle::class => ['all' => true],
];
On older Symfony, add it to app/AppKernel.php instead:
$bundles = [
// ...
new Sli\AuxBundle\SliAuxBundle(),
];
Look first at vendor/sergeil/aux-bundle/ — there is no docs site, so the source is the documentation. The two namespaces you will actually consume day-to-day are Sli\AuxBundle\Pagination and Sli\AuxBundle\Testing; the rest (Util, base classes) is smaller helper code.
First use case: reach for the paginator in a controller instead of hand-rolling setFirstResult/setMaxResults logic. Pass the query builder (or result set) plus the requested page and page size, then hand the result to the template. That single class is the reason most projects pull this bundle in.
If you are a Laravel developer: this is a Symfony bundle, not a Laravel package. There is no service provider, no facade. You can only consume the individual classes (Paginator, TokenGenerator) by copying/porting them, or by using it inside a Symfony app. Do not expect composer require to give you anything auto-wired in a Laravel app.
Pagination in controllers. Inject or instantiate Sli\AuxBundle\Pagination\Paginator, feed it a Doctrine query, and read page/size from the request. Keep the paginator out of entities; call it from the controller or a thin service so the same pattern repeats across list pages. The output exposes the current page's items plus the metadata (total pages, has previous/next) a Twig template needs. Because the bundle ships no DI extension, the paginator is not auto-registered — either new it up in the controller or register it as a service yourself in services.yaml (now trivially autowirable on Symfony 5).
Token / random-string generation for entities. Use Sli\AuxBundle\Util\TokenGenerator wherever you need an opaque identifier (slug tokens, invite codes, "remember me" secrets). It replaces ad-hoc bin2hex(random_bytes(...)) calls, and centralizing it means you can swap the implementation later without touching call sites.
Class/metadata utilities. Sli\AuxBundle\Util helpers (class-name resolution, reflection shortcuts) are useful when you build your own bundles that need to derive entity names, repository names, or route names convention-over-configuration style. This is the "base/utility classes for Sli/* bundles" in the description — its original job is to be the shared foundation for other Sli bundles (sortable, doctrine, etc.).
Functional test base class. Extend the Sli\AuxBundle\Testing\WebTestCase (and related test utilities) in tests/ to get a booted kernel, an authenticated client, and helpers for asserting JSON responses. This is often the fastest win: it standardises the boilerplate every functional test file otherwise repeats. The v1.1.3 Symfony 5 work is most relevant here — it is the part of the package that is most tightly coupled to Symfony/BrowserKit APIs.
Bundle-building pattern. When you write your own Sli-style bundle, mirror the package's structure: put reusable helpers (Util, Pagination, Testing) in your bundle's own namespace and have a thin *Bundle class with no DI extensions. That is exactly the convention this package demonstrates, so copying it keeps your code idiomatic to the ecosystem.
Maintenance risk is materially lower than it was, but still non-trivial. v1.1.3 is the first release since 2022-01-09 and ships a Symfony 5 compatibility fix — the maintainer is alive. That said: near-zero stars and dependents, and a multi-year gap before this release. Pin the exact version ("sergeil/aux-bundle": "1.1.3") and keep a vendored copy of the classes you actually use, so a future freeze or removal doesn't block you.
Symfony compatibility ceiling is now 5.x. v1.1.3 explicitly targets Symfony 5 ("sf5 compatibility"). It does not claim Symfony 6/7 support. If you are on Symfony 6/7, treat every class as unverified — smoke-test the paginator and the test base class before depending on them. On Symfony 5 you are in the supported window.
No DependencyInjection/ extension means no config.yml and no registered services. Do not look for a sli_aux: section; there are no parameters to tune and the paginator/test base are not in the container by default. If you need behaviour changes, subclass or decorate the utility class, or register your own service alias in services.yaml.
Namespaces are the extension point. The classes are intended to be extended (base controller, base test case, paginator override). Because they are concrete and un-final, you can subclass them in your App\ namespace and point your own services at the subclass. This is the supported way to customise without editing vendor code.
Debugging: if a class "does not exist", check the PSR-4 prefix in vendor/composer/autoload_psr4.php — it is Sli\AuxBundle\. A missing bundle registration and a wrong namespace casing are the two most common failure modes. On Symfony 5, a stale Symfony Flex cache after bumping from an older lock file is a close third — run bin/console cache:clear.
Do not import the whole bundle just for one helper. If you only need token generation, copy the ~30-line TokenGenerator into your own Util namespace; you avoid a transitive dependency on a low-activity bundle and gain full control. The paginator is worth pulling properly because it interacts with Doctrine, but the utility classes are trivial to internalise.
Testing base class quirk: these base test cases were written against older PHPUnit/Symfony\BrowserKit APIs and v1.1.3 only updated them as far as Symfony 5 requires. If your project's PHPUnit is newer (9/10), expect to override setUp/createClient and may need to patch assertions that reference removed methods. Budget an afternoon for the first test file that extends it.
How can I help you explore Laravel packages today?