peerj/peerj-user-security-bundle
PeerJ User Security Bundle adds user account security to PHP applications: authentication, registration, password reset, role-based access, and user management. A configurable bundle that integrates with existing user entities to simplify secure login and access control workflows.
This is a Symfony bundle, not a Laravel package. Before writing any code, confirm your stack: peerj/peerj-user-security-bundle extends Symfony\Component\HttpKernel\Bundle\Bundle and registers services via the Symfony DI container. There is no ServiceProvider, no config/ publish tag, and no facades. If you are running a pure Laravel app, this package will not "just work" — Composer will install it, but nothing in Laravel's bootstrap will load its Bundle class or its service definitions.
Where to look first, in order:
composer.json — check the require block. The bundle will almost certainly require one or more of symfony/framework-bundle, symfony/security-bundle, and possibly doctrine/orm. Those transitive dependencies are the real integration cost; installing them into a Laravel app is heavy and will fight with Laravel's own illuminate/* packages over shared contracts.src/ root — look for the *Bundle.php class and a DependencyInjection/ folder with *Extension.php. That extension is where config nodes and defaults live; it tells you every knob the package exposes.Resources/config/ (or config/) — the service definitions. This is the actual behavior of the package, and often the only documentation you'll get given 0 stars / 0 dependents.README.md and any docs/ — with a package this small and this old (last release 2024-09-17, no dependents), the README is likely the only usage guide, and it may assume you already know Symfony.First use case to target: peer security primitives that are language-agnostic — password strength rules, login throttling, or security-question validation — are the most portable part of a bundle like this. Find the concrete class that implements the rule (e.g. a validator implementing ConstraintValidatorInterface, or a service with a check() method), and call it directly from Laravel rather than trying to boot the whole bundle. If you cannot identify such a standalone class after a reasonable skim, treat the package as Symfony-only and stop evaluating it.
Pattern A — extract the logic, skip the bundle. The pragmatic path for a Laravel dev: pull the package in as a read-only dependency, find the pure-PHP service(s) doing the actual security work, and bind them yourself.
// app/Providers/AppServiceProvider.php
use PeerJ\UserSecurityBundle\Security\PasswordPolicy; // inspect src/ for real names
$this->app->singleton(PasswordPolicy::class, function ($app) {
return new PasswordPolicy(
minLength: config('security.password.min_length', 12),
);
});
Then wrap it in a Laravel Rule/Validator so it plugs into the normal $request->validate() pipeline. This is the highest-leverage use: you get the security logic, you don't drag the Symfony kernel in.
Pattern B — sidecar Symfony app. If the bundle's value is in its event listeners (login attempt tracking, throttling hooks) rather than pure logic, run a minimal Symfony app as a separate service for authentication/security events, and have Laravel call it over HTTP or a shared queue. This keeps the Symfony lifecycle intact and avoids trying to reconcile two DI containers.
Pattern C — bridging into Laravel's container (advanced). If you must use the bundle in-process, you need to instantiate the Symfony ContainerBuilder, register the bundle, load its extension config, and expose the services to Laravel:
use Symfony\Component\DependencyInjection\ContainerBuilder;
$container = new ContainerBuilder();
$container->registerExtension(new \PeerJ\UserSecurityBundle\DependencyInjection\PeerjUserSecurityExtension());
// load config, compile — you will almost certainly need to stub Symfony framework/security services
Realistically this requires more Symfony scaffolding than it saves. Only worth it if the bundle's service graph is genuinely complex.
Day-to-day workflow once integrated: the bundle's primitives should be exercised at the validation boundary — form requests, auth controllers, and password-reset flows. Do not try to make the bundle own Laravel's Auth guard; keep Laravel's guard in place and use the bundle only for the checks it performs on inputs and credentials.
Integration tip: pin the exact version (peerj/peerj-user-security-bundle: 2024.09.* or whatever the tag scheme is). With zero dependents, no one else is testing this against current Symfony/Laravel versions, and minor updates won't be caught by a community.
Bundle class will not be auto-registered in Laravel. If you install it, it sits inert. Any tutorial you find for this package will assume config/bundles.php in a Symfony app — that file has no Laravel equivalent.symfony/security-core and Laravel's illuminate/auth both define authentication primitives. Composer will resolve them, but at runtime you'll have two parallel security models. Keep them strictly separate (Pattern A or B).Configuration tree with ->cannotBeEmpty() and strict node types. If you instantiate services manually (Pattern A), you bypass that validation — replicate the constraints yourself or you'll silently accept invalid config.TokenStorageInterface, EntityManagerInterface). Search Resources/config/services.* for the service ID and read exactly what is passed in; that tells you what to stub.*Extension.php is where you'd normally add config; in Laravel terms, that's your config/peerj_user_security.php file — mirror the extension's defaults there so config is explicit rather than implicit in the package.How can I help you explore Laravel packages today?