Weave Code
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

Soft Deletable Bundle Laravel Package

andanteproject/soft-deletable-bundle

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Compliance with GDPR/Regulatory Requirements: Enables soft deletion to retain data temporarily while complying with data retention policies or legal holds, avoiding permanent deletion risks.
  • Feature Roadmap for Data Management:
    • Audit Trails: Integrate with logging systems to track soft-deleted records for compliance or debugging.
    • Temporary Data Recovery: Build a "restore" feature for soft-deleted entities (e.g., admin panel or API endpoint).
    • Bulk Soft-Deletion: Add batch-processing capabilities for large datasets (e.g., user cleanup workflows).
    • Custom Retention Policies: Extend the bundle to auto-delete records after a configurable period (e.g., 30 days).
  • Build vs. Buy:
    • Buy: Justifies adopting this package over custom development for teams lacking Doctrine expertise or needing rapid implementation.
    • Build: Ideal for teams requiring deep customization (e.g., multi-tenancy soft-deletion rules) or integrating with proprietary data models.
  • Use Cases:
    • User Accounts: Soft-delete inactive users instead of permanently removing them (e.g., for analytics or legal holds).
    • Content Management: Retain deleted blog posts/articles in drafts or archives without cluttering the live database.
    • E-Commerce: Preserve order history for returns/refunds while hiding canceled orders from active lists.
    • Multi-Tenant SaaS: Isolate soft-deleted data per tenant to avoid cross-contamination during migrations or audits.

When to Consider This Package

  • Adopt This Package If:

    • Your Symfony/Laravel (via Doctrine) application requires soft-deletion for compliance, auditing, or recovery purposes.
    • You need a zero-configuration solution with minimal boilerplate (trait-based implementation).
    • Your team prioritizes developer velocity over fine-grained control (e.g., no need for custom DQL queries).
    • You’re using Symfony 4.x–5.x and PHP 7.4+ (Laravel users can adapt via Doctrine Bridge).
    • You want to avoid hard-deletion risks (e.g., accidental DROP TABLE or schema migrations).
    • Your entities are CRUD-heavy (e.g., CMS, SaaS platforms) where soft-deletion aligns with business workflows.
  • Look Elsewhere If:

    • You need hard-deletion or multi-table soft-deletion (e.g., cascading deletes across related tables).
    • Your stack is non-Symfony (e.g., pure Laravel without Doctrine, or frameworks like Django/Node.js).
    • You require advanced filtering (e.g., soft-deleted records in search results) or custom deletion logic (e.g., trigger-based workflows).
    • Your team needs real-time sync with soft-deleted records (e.g., WebSockets or event-driven architectures).
    • You’re using Doctrine 3.x or Symfony 6.x+ (check for compatibility or alternatives like gedmo/doctrine-extensions).
    • You need soft-deletion for non-entity data (e.g., files, API responses, or NoSQL databases).

How to Pitch It (Stakeholders)

For Executives:

"This package lets us retain data temporarily without permanent loss, reducing compliance risks and enabling features like ‘undelete’ for users. For example, if a customer accidentally deletes their account, we can restore it within 30 days—boosting retention and trust. It’s a low-code, high-impact solution that integrates seamlessly with our existing Symfony stack, saving dev time while future-proofing our data management."

Key Outcomes:

  • Regulatory Compliance: Meet GDPR/data retention requirements without manual audits.
  • User Experience: Offer ‘recovery’ options for critical actions (e.g., orders, posts).
  • Cost Efficiency: Avoid custom development for a common pattern; MIT-licensed and actively maintained.

For Engineering:

*"This bundle provides a drop-in soft-deletion layer for Doctrine entities with zero config for 80% of use cases. It’s lightweight, trait-based, and plays well with Symfony’s ecosystem. Here’s how we’d leverage it:

  • Immediate Wins: Add SoftDeletableTrait to key entities (e.g., User, Post) in <5 minutes per entity.
  • Scalability: Disable filters per-entity or globally for edge cases (e.g., analytics queries).
  • Extensibility: Customize column names, indexes, or deletion logic via YAML config.
  • Laravel Adaptation: Use the Doctrine Bridge to port this to Laravel if needed.

Trade-offs:

  • No support for raw DQL (workaround: use QueryBuilder or disable filters).
  • Last release was 2021 (but MIT license allows forks; low-risk for stable features).

Next Steps:

  1. Pilot: Enable soft-deletion for User and Order entities in staging.
  2. Integrate: Hook into our logging system to track soft-deleted records.
  3. Roadmap: Build a ‘restore’ API endpoint using the disableFilter method."*

Tech Deep Dive:

  • How It Works: Adds a deleted_at column (indexed by default) and filters out soft-deleted records via Doctrine’s DQL WHERE deleted_at IS NULL.
  • Performance: Minimal overhead (indexed column + runtime filter).
  • Alternatives: gedmo/doctrine-extensions (more features but heavier) or custom traits (more maintenance)."
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle