PHPackages                             puleeno/rake-wordpress-migration-example - 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. puleeno/rake-wordpress-migration-example

ActiveWordpress-plugin

puleeno/rake-wordpress-migration-example
========================================

A powerful WordPress plugin for data migration and web crawling using Rake 2.0 framework

1.1(9mo ago)12[2 issues](https://github.com/puleeno/wp-crawlflow/issues)GPL-3.0-onlyPHPCI passing

Since Jul 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/puleeno/wp-crawlflow)[ Packagist](https://packagist.org/packages/puleeno/rake-wordpress-migration-example)[ RSS](/packages/puleeno-rake-wordpress-migration-example/feed)WikiDiscussions v2 Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

WP-CRAWFLOW PLUGIN
==================

[](#wp-crawflow-plugin)

**Phiên bản:** 2.0 **Ngày cập nhật:** 2025 **Kiến trúc:** Flow-Based Architecture **Tác giả:** Development Team

---

📋 MỤC LỤC
---------

[](#-mục-lục)

1. [Tổng quan WP-CrawlFlow](#t%E1%BB%95ng-quan-wp-crawlflow)
2. [Mục đích và ý nghĩa](#m%E1%BB%A5c-%C4%91%C3%ADch-v%C3%A0-%C3%BD-ngh%C4%A9a)
3. [Tại sao cần dùng WP-CrawlFlow](#t%E1%BA%A1i-sao-c%E1%BA%A7n-d%C3%B9ng-wp-crawlflow)
4. [Mối quan hệ với Rake Ecosystem](#m%E1%BB%91i-quan-h%E1%BB%87-v%E1%BB%9Bi-rake-ecosystem)
5. [Kiến trúc Plugin](#ki%E1%BA%BFn-tr%C3%BAc-plugin)
6. [Cách sử dụng](#c%C3%A1ch-s%E1%BB%AD-d%E1%BB%A5ng)
7. [Tài liệu kỹ thuật](#t%C3%A0i-li%E1%BB%87u-k%E1%BB%B9-thu%E1%BA%ADt)
8. [Development Guidelines](#development-guidelines)

---

🎯 TỔNG QUAN WP-CRAWFLOW
-----------------------

[](#-tổng-quan-wp-crawflow)

### Mục tiêu

[](#mục-tiêu)

WP-CrawlFlow 2.0 là WordPress plugin mạnh mẽ cho **data migration** và **web crawling** sử dụng Flow-Based Architecture, cung cấp:

- **Flow-Based Architecture**: Kiến trúc mới hoàn toàn dựa trên visual flow nodes để xử lý dữ liệu
- **Visual Flow Composer**: React Flow-based editor để tạo và quản lý crawl workflows
- **Node-Based System**: Hệ thống modular với các node types: Start, Click, Loop, Repository, Reception, Worker, Extractor, Processor, Completion
- **Database Migration System**: Hệ thống migration tự động với version tracking
- **Multiple Data Sources**: Hỗ trợ URL, API, MySQL, CSV, JSON, XML
- **WordPress Integration**: Tích hợp hoàn hảo với WordPress admin và database

### Vai trò trong hệ thống

[](#vai-trò-trong-hệ-thống)

```
┌─────────────────────────────────────────────────────────────┐
│                WP-CRAWFLOW PLUGIN                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────┐ │
│  │   DASHBOARD     │  │   MIGRATION     │  │    CRAWL    │ │
│  │     KERNEL      │  │     SYSTEM      │  │   ENGINE    │ │
│  │                 │  │                 │  │             │ │
│  │ • Screen Detect │  │ • Schema Update │  │ • URL Fetch │ │
│  │ • Data Loading  │  │ • Version Track │  │ • Data Parse│ │
│  │ • View Render   │  │ • Auto Migrate  │  │ • Store Data│ │
│  │ • Admin UI      │  │ • Rollback      │  │ • Queue Mgmt│ │
│  └─────────────────┘  └─────────────────┘  └─────────────┘ │
│                                                             │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────┐ │
│  │   FLOW COMPOSER │  │     LOGGER      │  │   PROJECT   │ │
│  │   (REACT)       │  │     SYSTEM      │  │  MANAGEMENT │ │
│  │                 │  │                 │  │             │ │
│  │ • Visual Editor │  │ • Lazy Loading  │  │ • CRUD Ops  │ │
│  │ • Flow Builder  │  │ • Daily Logs    │  │ • Settings  │ │
│  │ • Schema Design │  │ • Error Track   │  │ • Analytics │ │
│  │ • Data Preview  │  │ • CLI Support   │  │ • Export    │ │
│  └─────────────────┘  └─────────────────┘  └─────────────┘ │
└─────────────────────────────────────────────────────────────┘

```

---

🎯 MỤC ĐÍCH VÀ Ý NGHĨA
---------------------

[](#-mục-đích-và-ý-nghĩa)

### Mục đích chính

[](#mục-đích-chính)

WP-CrawlFlow được thiết kế để giải quyết các vấn đề phức tạp trong **data processing** và **web crawling**:

1. **Data Migration Automation**

    - Tự động migrate database schema
    - Version tracking và rollback
    - WordPress prefix integration
2. **Web Crawling Engine**

    - Crawl dữ liệu từ websites
    - Parse và transform data
    - Store vào WordPress database
3. **Visual Flow Design**

    - Giao diện visual để thiết kế flow
    - Drag &amp; drop interface
    - Real-time preview
4. **WordPress Integration**

    - Tích hợp hoàn hảo với WordPress admin
    - Sử dụng WordPress hooks và database
    - Security và permission handling

### Ý nghĩa trong hệ sinh thái

[](#ý-nghĩa-trong-hệ-sinh-thái)

```
┌─────────────────────────────────────────────────────────────┐
│                    CRAWLFLOW ECOSYSTEM                     │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐    ┌─────────────────┐    ┌─────────┐ │
│  │   WP-CRAWFLOW   │    │  CRAWLFLOW CLI  │    │ CRAWLFLOW│ │
│  │    PLUGIN       │    │    TOOL         │    │  CORE   │ │
│  │                 │    │                 │    │         │ │
│  │ • WordPress UI  │    │ • Command Line  │    │ • Engine│ │
│  │ • Visual Editor │    │ • Batch Process │    │ • API   │ │
│  │ • Admin Panel   │    │ • Scripts       │    │ • Core  │ │
│  └─────────────────┘    └─────────────────┘    └─────────┘ │
│                                                             │
│  ┌─────────────────┐    ┌─────────────────┐    ┌─────────┐ │
│  │   CRAWLFLOW     │    │   CRAWLFLOW     │    │ CRAWLFLOW│ │
│  │   DASHBOARD     │    │   ANALYTICS     │    │  QUEUE  │ │
│  │                 │    │                 │    │         │ │
│  │ • Real-time     │    │ • Data Insights │    │ • Jobs  │ │
│  │ • Monitoring    │    │ • Reports       │    │ • Tasks │ │
│  │ • Alerts        │    │ • Charts        │    │ • Queue │ │
│  └─────────────────┘    └─────────────────┘    └─────────┘ │
└─────────────────────────────────────────────────────────────┘

```

---

🤔 TẠI SAO CẦN DÙNG WP-CRAWFLOW
------------------------------

[](#-tại-sao-cần-dùng-wp-crawflow)

### Vấn đề hiện tại

[](#vấn-đề-hiện-tại)

1. **Manual Data Processing**

    - Phải viết code thủ công cho mỗi website
    - Không có template hay pattern chung
    - Khó maintain và scale
2. **WordPress Limitations**

    - WordPress không có built-in crawling
    - Không có visual flow designer
    - Database migration phức tạp
3. **Development Overhead**

    - Phải build từ đầu cho mỗi project
    - Không có framework chung
    - Khó debug và monitor

### Giải pháp của WP-CrawlFlow

[](#giải-pháp-của-wp-crawlflow)

#### 1. **Flow-based Architecture**

[](#1-flow-based-architecture)

```
// Thay vì viết code thủ công
$data = file_get_contents($url);
$parsed = parseData($data);
saveToDatabase($parsed);

// Sử dụng visual flow composer
// Drag & drop các components
// Auto generate code
```

#### 2. **WordPress Integration**

[](#2-wordpress-integration)

```
// Tích hợp hoàn hảo với WordPress
add_action('wp_ajax_crawlflow_save_project', [$this, 'handleSaveProject']);
add_action('admin_menu', [$this, 'registerMenu']);
add_action('wp_loaded', [$this, 'initialize']);
```

#### 3. **Visual Development**

[](#3-visual-development)

```
// React-based visual composer
const ProjectComposer = () => {
    const [nodes, setNodes] = useState([]);
    const [edges, setEdges] = useState([]);

    return (

    );
};
```

#### 4. **Automated Migration**

[](#4-automated-migration)

```
// Tự động migrate database
$migrationService = new MigrationService();
$result = $migrationService->runMigrations();

// Version tracking
$version = $migrationService->getCurrentVersion();
```

---

🔗 MỐI QUAN HỆ VỚI RAKE ECOSYSTEM
--------------------------------

[](#-mối-quan-hệ-với-rake-ecosystem)

### Dependency Chain

[](#dependency-chain)

```
┌─────────────────┐    depends on    ┌─────────────────┐    depends on    ┌─────────────────┐
│   WP-CRAWFLOW   │ ────────────────▶ │ RAKE WORDPRESS  │ ────────────────▶ │   RAKE CORE     │
│     PLUGIN      │                  │    ADAPTER      │                  │   FRAMEWORK     │
└─────────────────┘                  └─────────────────┘                  └─────────────────┘
         │                                    │                                    │
         │ uses                               │ uses                               │ uses
         ▼                                    ▼                                    ▼
┌─────────────────┐                  ┌─────────────────┐                  ┌─────────────────┐
│   WORDPRESS     │                  │   WORDPRESS     │                  │   PHP 8.1+      │
│   ENVIRONMENT   │                  │   DATABASE      │                  │   COMPOSER      │
└─────────────────┘                  └─────────────────┘                  └─────────────────┘

```

### Package Dependencies

[](#package-dependencies)

```
{
    "name": "crawlflow/crawlflow",
    "require": {
        "php": ">=8.1",
        "ramphor/rake": "^2.0",
        "puleeno/rake-wordpress-adapter": "^2.0"
    },
    "autoload": {
        "psr-4": {
            "CrawlFlow\\": "src/"
        }
    }
}
```

### Service Integration

[](#service-integration)

```
// WP-CrawlFlow sử dụng Rake Core
use Rake\Rake;
use Rake\Facade\Logger;
use Rake\Manager\Database\MigrationManager;

// WP-CrawlFlow sử dụng Rake WordPress Adapter
use Rake\WordPress\Database\WordPressDatabaseAdapter;
use Rake\WordPress\Hooks\WordPressHooksAdapter;
use Rake\WordPress\Admin\WordPressAdminAdapter;

// Service registration
$app = new Rake();
$app->singleton(DatabaseAdapterInterface::class, WordPressDatabaseAdapter::class);
$app->singleton(WordPressHooksInterface::class, WordPressHooksAdapter::class);
$app->singleton(WordPressAdminInterface::class, WordPressAdminAdapter::class);
```

---

🏗️ KIẾN TRÚC PLUGIN
-------------------

[](#️-kiến-trúc-plugin)

### Package Structure

[](#package-structure)

```
wp-crawlflow/
├── src/
│   ├── Kernel/                     # Rake Kernel implementations
│   │   ├── CrawlFlowDashboardKernel.php
│   │   ├── CrawlFlowMigrationKernel.php
│   │   └── CrawlFlowConsoleKernel.php
│   ├── Admin/                      # WordPress Admin integration
│   │   ├── CrawlFlowController.php
│   │   ├── DashboardService.php
│   │   ├── ProjectService.php
│   │   ├── MigrationService.php
│   │   ├── LogService.php
│   │   └── DashboardRenderer.php
│   ├── Bootstrapper/               # Rake Bootstrapper implementations
│   │   ├── CrawlFlowDashboardBootstrapper.php
│   │   ├── CrawlFlowMigrationBootstrapper.php
│   │   └── CrawlFlowCoreBootstrapper.php
│   ├── ServiceProvider/            # Rake Service Provider implementations
│   │   ├── CrawlFlowDashboardServiceProvider.php
│   │   ├── CrawlFlowMigrationServiceProvider.php
│   │   └── CrawlFlowCoreServiceProvider.php
│   └── Logger/                     # Logging system
│       └── CrawlFlowLogger.php
├── assets/
│   ├── css/
│   │   ├── admin.css              # Admin styles
│   │   └── composer.css           # Flow composer styles
│   └── js/
│       ├── admin.js               # Admin JavaScript
│       └── composer-simple.js     # React flow composer
├── vendor/                         # Composer dependencies
├── wp-crawlflow.php               # Main plugin file
├── composer.json
└── README.md

```

### Architecture Flow

[](#architecture-flow)

```
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   WORDPRESS     │    │   WP-CRAWFLOW   │    │   RAKE CORE     │
│   ADMIN         │    │     PLUGIN      │    │   FRAMEWORK     │
│                 │    │                 │    │                 │
│ • Menu Pages    │───▶│ • Dashboard     │───▶│ • Container     │
│ • AJAX Actions  │    │ • Migration     │    │ • Kernel        │
│ • Admin Scripts │    │ • Flow Composer │    │ • Services      │
│ • Admin Styles  │    │ • Logger        │    │ • Facades       │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         │                       │                       │
         ▼                       ▼                       ▼
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   WORDPRESS     │    │   RAKE WORDPRESS│    │   PHP/COMPOSER  │
│   DATABASE      │    │    ADAPTER      │    │   ENVIRONMENT   │
│                 │    │                 │    │                 │
│ • wp_posts      │    │ • Database      │    │ • Autoloader    │
│ • wp_options    │    │ • Hooks         │    │ • Dependencies  │
│ • Custom Tables │    │ • Admin         │    │ • Extensions    │
│ • Migrations    │    │ • Security      │    │ • Configuration │
└─────────────────┘    └─────────────────┘    └─────────────────┘

```

---

🚀 CÁCH SỬ DỤNG
--------------

[](#-cách-sử-dụng)

### 1. Cài đặt

[](#1-cài-đặt)

#### WordPress Plugin Installation

[](#wordpress-plugin-installation)

```
# Upload to WordPress plugins directory
wp-content/plugins/wp-crawlflow/

# Activate plugin trong WordPress admin
# Plugin sẽ tự động run migrations
```

#### Composer Installation

[](#composer-installation)

```
composer create-project crawlflow/crawlflow wp-content/plugins/crawlflow
```

### 2. Khởi tạo Plugin

[](#2-khởi-tạo-plugin)

```
// Trong wp-crawlflow.php
class WP_CrawlFlow
{
    private Rake $app;
    private CrawlFlowController $controller;

    public function __construct()
    {
        // Initialize Rake container
        $this->app = new Rake();

        // Register service providers
        $this->app->register(new CrawlFlowCoreServiceProvider());
        $this->app->register(new CrawlFlowDashboardServiceProvider());
        $this->app->register(new CrawlFlowMigrationServiceProvider());

        // Initialize controller
        $this->controller = new CrawlFlowController($this->app);
        $this->controller->registerHooks();
    }
}
```

### 3. Sử dụng Dashboard

[](#3-sử-dụng-dashboard)

#### Access Dashboard

[](#access-dashboard)

```
WordPress Admin → CrawlFlow → Projects

```

#### Create New Project

[](#create-new-project)

```
// Sử dụng ProjectService
$projectService = new ProjectService();

$project = $projectService->createProject([
    'name' => 'My Crawl Project',
    'description' => 'Crawl data from website',
    'settings' => [
        'url' => 'https://example.com',
        'selectors' => ['h1', 'h2', '.content'],
        'output_format' => 'json'
    ]
]);
```

#### Visual Flow Composer

[](#visual-flow-composer)

```
// React-based flow composer
const ProjectComposer = () => {
    const [nodes, setNodes] = useState([
        {
            id: '1',
            type: 'input',
            data: { label: 'Start' },
            position: { x: 0, y: 0 }
        },
        {
            id: '2',
            type: 'crawl',
            data: { label: 'Crawl URL' },
            position: { x: 200, y: 0 }
        }
    ]);

    return (

    );
};
```

### 4. Database Migration

[](#4-database-migration)

#### Automatic Migration

[](#automatic-migration)

```
// Plugin tự động run migrations khi activate
$migrationService = new MigrationService($app);
$result = $migrationService->runMigrations();

if ($result['success']) {
    Logger::info('Migrations completed successfully');
} else {
    Logger::error('Migration failed: ' . $result['error']);
}
```

#### Manual Migration

[](#manual-migration)

```
// Run migrations manually
$kernel = new CrawlFlowMigrationKernel($app);
$kernel->runMigrations();

// Check migration status
$status = $kernel->checkMigrationStatus();
echo "Current version: " . $status['current_version'];
```

### 5. Logging System

[](#5-logging-system)

#### Lazy Loading Logger

[](#lazy-loading-logger)

```
use Rake\Facade\Logger;

// Logger chỉ được initialize khi cần
Logger::info('Starting crawl process');
Logger::error('Crawl failed', ['url' => $url, 'error' => $error]);
Logger::debug('Processing data', ['count' => count($data)]);
```

#### Log Files

[](#log-files)

```
wp-content/crawlflow/
├── crawlflow-2025-01-15.log
├── crawlflow-2025-01-16.log
└── crawlflow-2025-01-17.log

```

### 6. AJAX Operations

[](#6-ajax-operations)

#### Save Project

[](#save-project)

```
// JavaScript
jQuery.post(ajaxurl, {
    action: 'crawlflow_save_project',
    nonce: crawlflowAdmin.nonce,
    project: projectData
}, function(response) {
    if (response.success) {
        alert('Project saved successfully');
    }
});
```

```
// PHP Handler
public function handleSaveProject()
{
    if (!wp_verify_nonce($_POST['nonce'], 'crawlflow_save_project')) {
        wp_die('Security check failed');
    }

    $projectService = new ProjectService();
    $result = $projectService->createProject($_POST['project']);

    if ($result) {
        wp_send_json_success(['id' => $result]);
    } else {
        wp_send_json_error('Failed to save project');
    }
}
```

### 7. Admin Menu Integration

[](#7-admin-menu-integration)

```
// Register admin menu
public function registerMenu()
{
    add_menu_page(
        'CrawlFlow',
        'CrawlFlow',
        'manage_options',
        'crawlflow',
        [$this, 'renderProjectsPage'],
        'dashicons-networking',
        30
    );

    add_submenu_page(
        'crawlflow',
        'Projects',
        'Projects',
        'manage_options',
        'crawlflow',
        [$this, 'renderProjectsPage']
    );

    add_submenu_page(
        'crawlflow',
        'Logs',
        'Logs',
        'manage_options',
        'crawlflow-logs',
        [$this, 'renderLogsPage']
    );
}
```

---

📚 TÀI LIỆU KỸ THUẬT
-------------------

[](#-tài-liệu-kỹ-thuật)

### Tài liệu chi tiết

[](#tài-liệu-chi-tiết)

📖 [`docs/technical-documentation.md`](docs/technical-documentation.md)

**Nội dung:**

- Flow-based Architecture
- Dashboard Kernel System
- Migration System
- Visual Flow Composer
- WordPress Integration
- Development Guidelines

### Code Examples

[](#code-examples)

#### Dashboard Kernel

[](#dashboard-kernel)

```
class CrawlFlowDashboardKernel extends AbstractKernel
{
    private DashboardService $dashboardService;
    private CrawlFlowController $controller;

    public function __construct(Rake $app)
    {
        parent::__construct($app);

        $this->dashboardService = new DashboardService();
        $this->controller = new CrawlFlowController($app);

        $this->detectCurrentScreen();
        $this->loadScreenData();
    }

    public function render(): void
    {
        $this->controller->renderPage();
    }
}
```

#### Migration Service

[](#migration-service)

```
class MigrationService
{
    private Rake $app;
    private WordPressDatabaseAdapter $adapter;

    public function __construct(Rake $app)
    {
        $this->app = $app;
        $this->adapter = new WordPressDatabaseAdapter();
    }

    public function runMigrations(): array
    {
        try {
            $schemaPath = $this->app->get('migration_schema_path');
            $definitions = $this->getSchemaDefinitions($schemaPath);

            foreach ($definitions as $table => $schema) {
                $this->createTable($table, $schema);
            }

            return ['success' => true];
        } catch (Exception $e) {
            Logger::error('Migration failed: ' . $e->getMessage());
            return ['success' => false, 'error' => $e->getMessage()];
        }
    }
}
```

#### Project Service

[](#project-service)

```
class ProjectService
{
    private WordPressDatabaseAdapter $adapter;

    public function createProject(array $data): int
    {
        $data['created_at'] = current_time('mysql');
        $data['updated_at'] = current_time('mysql');

        return $this->adapter->insert('crawlflow_projects', $data);
    }

    public function getProjects(): array
    {
        return $this->adapter->getResults("
            SELECT * FROM {$this->adapter->getPrefix()}crawlflow_projects
            ORDER BY created_at DESC
        ");
    }
}
```

---

🛠️ DEVELOPMENT GUIDELINES
-------------------------

[](#️-development-guidelines)

### Coding Standards

[](#coding-standards)

#### WordPress Integration Best Practices

[](#wordpress-integration-best-practices)

```
// Always use WordPress functions with backslash prefix
$result = \wp_verify_nonce($nonce, $action);

// Use WordPress security functions
$sanitized = \sanitize_text_field($input);

// Check capabilities before actions
if (\current_user_can('manage_options')) {
    // Perform admin action
}

// Use WordPress hooks properly
\add_action('init', [$this, 'initialize']);
```

#### Rake Framework Integration

[](#rake-framework-integration)

```
// Use Rake Facades
use Rake\Facade\Logger;

Logger::info('Operation started');
Logger::error('Operation failed', ['context' => $data]);

// Use Rake Container
$app = new Rake();
$service = $app->make(ServiceInterface::class);

// Use Rake Database Adapter
$adapter = new WordPressDatabaseAdapter();
$result = $adapter->query('SELECT * FROM table');
```

### Testing Guidelines

[](#testing-guidelines)

#### Unit Testing

[](#unit-testing)

```
class CrawlFlowControllerTest extends TestCase
{
    private CrawlFlowController $controller;

    protected function setUp(): void
    {
        $app = new Rake();
        $this->controller = new CrawlFlowController($app);
    }

    public function testSaveProject(): void
    {
        // Arrange
        $projectData = [
            'name' => 'Test Project',
            'description' => 'Test Description'
        ];

        // Act
        $result = $this->controller->handleSaveProject($projectData);

        // Assert
        $this->assertTrue($result['success']);
    }
}
```

#### Integration Testing

[](#integration-testing)

```
class CrawlFlowIntegrationTest extends TestCase
{
    public function testDashboardRendering(): void
    {
        // Arrange
        $app = new Rake();
        $kernel = new CrawlFlowDashboardKernel($app);

        // Act
        ob_start();
        $kernel->render();
        $output = ob_get_clean();

        // Assert
        $this->assertStringContainsString('CrawlFlow', $output);
    }
}
```

### Error Handling

[](#error-handling)

```
class CrawlFlowException extends Exception
{
    public function __construct(string $message, array $context = [], int $code = 0, ?Throwable $previous = null)
    {
        parent::__construct("CrawlFlow error: {$message}", $code, $previous);
    }
}

// Usage
try {
    $migrationService = new MigrationService($app);
    $result = $migrationService->runMigrations();
} catch (CrawlFlowException $e) {
    Logger::error('CrawlFlow operation failed: ' . $e->getMessage());
}
```

---

🔧 CONFIGURATION
---------------

[](#-configuration)

### WordPress Settings

[](#wordpress-settings)

Plugin tự động sử dụng WordPress database settings:

```
// Tự động detect từ WordPress
$adapter = new WordPressDatabaseAdapter();
echo $adapter->getPrefix();        // wp_
echo $adapter->getCharset();       // utf8mb4
echo $adapter->getCollation();     // utf8mb4_unicode_ci
```

### Plugin Configuration

[](#plugin-configuration)

```
// Logger configuration
add_filter('crawlflow/logger', function($path) {
    return '/custom/path/to/logs/crawlflow.log';
});

// Migration configuration
add_filter('crawlflow/migration_schema_path', function($path) {
    return '/custom/path/to/schemas/';
});
```

---

🚨 TROUBLESHOOTING
-----------------

[](#-troubleshooting)

### Common Issues

[](#common-issues)

#### Error: `Class 'CrawlFlow\Admin\CrawlFlowController' not found`

[](#error-class-crawlflowadmincrawlflowcontroller-not-found)

**Solution:**

```
composer dump-autoload
```

#### Error: `WordPress not loaded`

[](#error-wordpress-not-loaded)

**Solution:**

```
// Ensure WordPress is loaded
require_once 'wp-load.php';
```

#### Error: `Database migration failed`

[](#error-database-migration-failed)

**Solution:**

```
// Check database permissions
// Verify WordPress database configuration
// Check migration schema files
```

### Debug Mode

[](#debug-mode)

```
// Enable debug mode
define('CRAWFLOW_DEBUG', true);

// Check logs
Logger::debug('Debug information');
Logger::error('Error information');
```

---

📊 PERFORMANCE
-------------

[](#-performance)

### Optimizations

[](#optimizations)

- **Lazy loading**: Logger chỉ initialize khi cần
- **Database optimization**: Sử dụng WordPress database adapter
- **Memory management**: Efficient memory usage
- **Caching**: WordPress cache integration

### Best Practices

[](#best-practices)

```
// Use transactions for multiple operations
$adapter->beginTransaction();
try {
    foreach ($projects as $project) {
        $adapter->insert('crawlflow_projects', $project);
    }
    $adapter->commit();
} catch (Exception $e) {
    $adapter->rollback();
    throw $e;
}

// Use batch operations
$adapter->getResults("SELECT * FROM crawlflow_projects LIMIT 1000");

// Use specific columns
$adapter->getResults("SELECT id, name FROM crawlflow_projects WHERE status = 'active'");
```

---

🎯 KẾT LUẬN
----------

[](#-kết-luận)

WP-CrawlFlow cung cấp giải pháp hoàn chỉnh cho **data migration** và **web crawling** trong WordPress với:

### Điểm nổi bật:

[](#điểm-nổi-bật)

1. **Flow-based Architecture**: Kiến trúc dựa trên flow để xử lý dữ liệu
2. **Visual Flow Composer**: Giao diện visual để thiết kế flow
3. **WordPress Integration**: Tích hợp hoàn hảo với WordPress
4. **Rake Framework**: Built trên Rake 2.0 framework
5. **Automated Migration**: Hệ thống migration tự động

### Sử dụng:

[](#sử-dụng)

```
// Initialize plugin
$plugin = new WP_CrawlFlow();

// Use dashboard
// WordPress Admin → CrawlFlow → Projects

// Use visual composer
// Projects → Add New → Visual Flow Composer

// Use migration
$migrationService = new MigrationService($app);
$result = $migrationService->runMigrations();
```

### Lợi ích:

[](#lợi-ích)

- **Giảm development time**: Visual composer thay vì code thủ công
- **Tăng productivity**: Flow-based architecture
- **Dễ maintain**: WordPress integration
- **Scalable**: Rake framework foundation
- **User-friendly**: Visual interface

---

**Tài liệu này sẽ được cập nhật thường xuyên khi có thay đổi trong plugin.**

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance48

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

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 ~90 days

Total

3

Last Release

119d ago

Major Versions

1.1 → v2.x-dev2026-01-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/6a609a3b3a36dee9f36ef6f8d3b2b2dc91eebefc7644031e829e65bca4329799?d=identicon)[puleeno](/maintainers/puleeno)

---

Top Contributors

[![puleeno](https://avatars.githubusercontent.com/u/22538657?v=4)](https://github.com/puleeno "puleeno (275 commits)")

### Embed Badge

![Health badge](/badges/puleeno-rake-wordpress-migration-example/health.svg)

```
[![Health](https://phpackages.com/badges/puleeno-rake-wordpress-migration-example/health.svg)](https://phpackages.com/packages/puleeno-rake-wordpress-migration-example)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M700](/packages/league-commonmark)[alexpechkarev/google-maps

Collection of Google Maps API Web Services for Laravel

5653.2M2](/packages/alexpechkarev-google-maps)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M262](/packages/ssch-typo3-rector)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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