AppKernel, Doctrine annotations, Symfony container). If the project is not Symfony-based, this package is non-applicable.AppKernel → config/bundles.php).Security component ($this->getUser() in controllers) or API Platform’s CurrentUser extension. This bundle adds indirect value unless it solves a niche use case (e.g., Doctrine lifecycle callbacks for auto-populating createdBy/updatedBy fields).@Dyvelop\CurrentUser) is non-standard and may conflict with existing Doctrine lifecycle callbacks or custom drivers.dyvelop.current_user.provider returns null when unauthenticated.User interface.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Version Mismatch | High | Test with a Symfony 3.x/4.x compatibility layer or fork. |
| Doctrine Annotation Conflicts | Medium | Audit existing entity listeners; prefer Symfony’s Security component for simple cases. |
| Deprecated APIs | Medium | Check for AppKernel deprecations (Symfony 4+ uses config/bundles.php). |
| No Active Maintenance | Low | Use as-is if critical; otherwise, implement a custom solution (e.g., a trait for getCurrentUser()). |
| License Compliance | Low | MIT license is permissive; no issues expected. |
Why not use Symfony’s built-in $this->getUser()?
createdBy)?Symfony Version Compatibility:
AppKernel) that need migration?Alternatives:
Doctrine Strategy:
createdBy/updatedBy fields currently managed? (Manual? Listeners?)Voters or Doctrine extensions (e.g., STI) suffice?Long-Term Viability:
AppKernel with config/bundles.php.Assessment Phase:
createdBy/updatedBy logic (replace or extend).Proof of Concept (PoC):
dyvelop.current_user.provider in a service and controller.Integration Steps:
$this->getUser() with dyvelop.current_user.provider where needed.@Dyvelop\CurrentUser (if applicable).Fallback Plan:
Security component.// src/EventListener/CurrentUserListener.php
use Symfony\Component\Security\Core\User\UserInterface;
class CurrentUserListener
{
public function prePersist($entity, LifecycleEventArgs $args)
{
if ($entity instanceof AutoUserEntityInterface) {
$entity->setCreatedBy($this->getCurrentUser());
}
}
private function getCurrentUser(): ?UserInterface
{
return $this->container->get('security.token_storage')->getToken()->getUser();
}
}
| Component | Compatibility Notes |
|---|---|
| Symfony | Tested on 2.x/3.x; 4+/5.x may need config/bundles.php tweaks. |
| Doctrine | Uses Doctrine 2.x annotations; may conflict with Doctrine 3.x attributes. |
| PHP | Likely PHP 5.6+; no PHP 8 features (e.g., union types). |
| Security | Assumes Symfony’s Security component; incompatible with custom auth. |
CurrentUserAware trait.createdBy).var_dump($this->container->get('dyvelop.current_user.provider')->getUser()) to verify user context.$this->getUser() in controllers.doctrine:schema:validate).| Failure Scenario | Impact | Recovery Strategy |
|---|---|---|
| **Bundle not |
How can I help you explore Laravel packages today?