# auto-alt-text/2.7.0/src/App/Core/PluginLifecycle.php

Auto Alt Text, version 2.7.0. 56 lines.

- Page: https://pluginprobe.com/plugins/auto-alt-text/2.7.0/code/src/App/Core/PluginLifecycle.php
- Raw: https://pluginprobe.com/plugins/auto-alt-text/2.7.0/raw/src/App/Core/PluginLifecycle.php
- Modified: 2026-01-14T13:38:28+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/auto-alt-text/2.7.0/code/src/App/Core/PluginLifecycle.php#L10-L20`.

```php
<?php

namespace AATXT\App\Core;

use AATXT\App\Infrastructure\Database\ErrorLogSchema;

/**
 * Handles plugin lifecycle events (activation/deactivation).
 *
 * This class follows the Single Responsibility Principle by handling
 * only lifecycle-related operations like database schema management.
 */
final class PluginLifecycle
{
    /**
     * Database schema manager for error logs table
     *
     * @var ErrorLogSchema
     */
    private $schema;

    /**
     * Constructor
     *
     * @param ErrorLogSchema $schema Database schema manager
     */
    public function __construct(ErrorLogSchema $schema)
    {
        $this->schema = $schema;
    }

    /**
     * Handle plugin activation.
     *
     * Creates necessary database tables.
     *
     * @return void
     */
    public function activate(): void
    {
        $this->schema->create();
    }

    /**
     * Handle plugin deactivation.
     *
     * Drops database tables created by the plugin.
     *
     * @return void
     */
    public function deactivate(): void
    {
        $this->schema->drop();
    }
}

```
