PHPackages                             tourze/product-auto-down-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tourze/product-auto-down-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

tourze/product-auto-down-bundle
===============================

商品自动下架功能

0.0.3(5mo ago)00MITPHPCI failing

Since Nov 13Pushed 4mo agoCompare

[ Source](https://github.com/tourze/product-auto-down-bundle)[ Packagist](https://packagist.org/packages/tourze/product-auto-down-bundle)[ RSS](/packages/tourze-product-auto-down-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (45)Versions (4)Used By (0)

Product Auto Down Bundle
========================

[](#product-auto-down-bundle)

[English](README.md) | [中文](README.zh-CN.md)

Product Auto Down Bundle provides automated product takedown functionality for Symfony applications. It allows you to schedule products to be automatically taken down at a specified time.

Features
--------

[](#features)

- **Scheduled Takedown**: Set specific times for products to be automatically taken down
- **Command Line Interface**: Console commands for executing and managing takedowns
- **Admin Interface**: EasyAdmin integration for managing configurations
- **Logging System**: Comprehensive logging for all takedown actions
- **Batch Processing**: Efficient batch execution of scheduled takedowns
- **Clean Up Tools**: Automatic cleanup of old configurations

Installation
------------

[](#installation)

```
composer require tourze/product-auto-down-bundle
```

Configuration
-------------

[](#configuration)

### 1. Register the Bundle

[](#1-register-the-bundle)

```
// config/bundles.php
return [
    // ...
    Tourze\ProductAutoDownBundle\ProductAutoDownBundle::class => ['all' => true],
];
```

### 2. Run Database Migrations

[](#2-run-database-migrations)

```
# Create and run migrations
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
```

### 3. Load Demo Fixtures (Optional)

[](#3-load-demo-fixtures-optional)

```
# Load demo fixtures
php bin/console doctrine:fixtures:load --group=ProductAutoDownBundle
```

Usage
-----

[](#usage)

### Console Commands

[](#console-commands)

The bundle provides commands for managing automatic takedowns:

```
# Execute scheduled takedowns
php bin/console product:auto-take-down-spu

# Execute with specific datetime
php bin/console product:auto-take-down-spu --datetime="2024-12-31 23:59:59"

# Force execution (skip confirmation)
php bin/console product:auto-take-down-spu --force

# Verbose output
php bin/console product:auto-take-down-spu -v
```

**Command Options**:

- `--datetime` : Specify execution time in format: `Y-m-d H:i:s`
- `--force` : Force execution without confirmation prompts
- `-v|--verbose` : Display detailed execution information

### Service API

[](#service-api)

### AutoDownService

[](#autodownservice)

The main service for managing automatic takedowns:

```
use Tourze\ProductAutoDownBundle\Service\AutoDownService;

class YourController
{
    public function __construct(
        private AutoDownService $autoDownService
    ) {}

    public function scheduleAutoDown(): void
    {
        // Configure SPU auto takedown
        $config = $this->autoDownService->configureAutoTakeDownTime(
            spu: $spuEntity,
            autoTakeDownTime: new \DateTimeImmutable('+1 week')
        );

        // Cancel SPU auto takedown
        $success = $this->autoDownService->cancelAutoTakeDown(123);

        // Execute scheduled takedowns
        $executedCount = $this->autoDownService->executeAutoTakeDown();

        // Get active configuration count
        $count = $this->autoDownService->countActiveConfigs();

        // Clean up old configurations
        $cleaned = $this->autoDownService->cleanupOldConfigs(30);
    }
}
```

### Repository Methods

[](#repository-methods)

```
use Tourze\ProductAutoDownBundle\Repository\AutoDownTimeConfigRepository;
use Tourze\ProductAutoDownBundle\Repository\AutoDownLogRepository;

// Configuration repository
$configs = $configRepository->findActiveConfigs(); // Find active configs
$config = $configRepository->findBySpu(123);       // Find by SPU ID
$count = $configRepository->countActiveConfigs();  // Count active configs

// Log repository
$logs = $logRepository->findBySpuId(123);         // Find SPU logs
$logs = $logRepository->findByAction($action);    // Find by action type
$stats = $logRepository->countByActions();        // Action statistics
```

Admin Interface
---------------

[](#admin-interface)

The bundle integrates with EasyAdmin for configuration management:

- **Auto Down Config**: `/admin/product/auto-down-config`

    - View and manage auto takedown configurations
    - Link to SPU entities
    - Enable/disable configurations
- **Takedown Logs**: `/admin/product/auto-down-logs`

    - View detailed execution logs
    - Track SPU takedown history
    - Filter by action and time

Database Schema
---------------

[](#database-schema)

### AutoDownTimeConfig (Configuration Table)

[](#autodowntimeconfig-configuration-table)

ColumnTypeDescriptionidintPrimary IDspuSpuRelated SPU entityautoTakeDownTimeDateTimeImmutableScheduled takedown timeisActiveboolWhether configuration is activecreateTimeDateTimeImmutableCreation timeupdateTimeDateTimeImmutableLast update time### AutoDownLog (Log Table)

[](#autodownlog-log-table)

ColumnTypeDescriptionidstringUnique log IDconfigAutoDownTimeConfigRelated configurationspuIdintProduct SPU IDactionAutoDownLogActionLog action typemessagestringLog messagecontextarrayAdditional context datacreateTimeDateTimeImmutableLog creation timecreatedFromIpstringSource IP address### AutoDownLogAction (Action Types)

[](#autodownlogaction-action-types)

ValueDescriptionMeaningSCHEDULEDScheduledConfiguration created/updatedEXECUTEDExecutedTakedown successfully executedCANCELEDCanceledConfiguration was canceledSKIPPEDSkippedTakedown skipped (already down)ERRORErrorError occurred during executionError Handling
--------------

[](#error-handling)

The bundle provides specific exceptions for error handling:

```
use Tourze\ProductAutoDownBundle\Exception\SpuNotFoundException;
use Tourze\ProductAutoDownBundle\Exception\AutoDownServiceException;

try {
    $this->autoDownService->configureAutoTakeDownTime($spu, $time);
} catch (SpuNotFoundException $e) {
    // SPU not found
} catch (AutoDownServiceException $e) {
    // General service error
}
```

Scheduled Execution
-------------------

[](#scheduled-execution)

Configure the command to run automatically using cron or Symfony Cron Jobs Bundle:

```
# crontab -e
# Run every hour
0 * * * * cd /var/www/project && php bin/console product:auto-take-down-spu
```

Using Symfony Cron Jobs Bundle:

```
// config/packages/cron_jobs.yaml
cron_jobs:
    auto_take_down_spu:
        command: 'product:auto-take-down-spu'
        schedule: '0 * * * *'  # Every hour
        description: 'Execute scheduled product takedowns'
```

Testing
-------

[](#testing)

### Unit Tests

[](#unit-tests)

```
# Run all tests
./vendor/bin/phpunit packages/product-auto-down-bundle/tests

# Run specific test file
./vendor/bin/phpunit packages/product-auto-down-bundle/tests/Service/AutoDownServiceTest.php

# Generate coverage report
./vendor/bin/phpunit packages/product-auto-down-bundle/tests --coverage-html=coverage
```

### Code Quality

[](#code-quality)

```
# PHPStan static analysis
./vendor/bin/phpstan analyse packages/product-auto-down-bundle --level=8

# Code style check
./vendor/bin/php-cs-fixer fix packages/product-auto-down-bundle/src --dry-run
```

License
-------

[](#license)

MIT License

Support
-------

[](#support)

Tourze Team

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance72

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

177d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-product-auto-down-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-product-auto-down-bundle/health.svg)](https://phpackages.com/packages/tourze-product-auto-down-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
