PHP code example of tourze / wechat-mini-program-stats-bundle

1. Go to this page and download the library: Download tourze/wechat-mini-program-stats-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tourze / wechat-mini-program-stats-bundle example snippets


return [
    // ...
    WechatMiniProgramStatsBundle\WechatMiniProgramStatsBundle::class => ['all' => true],
];

use Symfony\Component\Console\Application;
use WechatMiniProgramStatsBundle\Command\DataCube\GetDailySummaryCommand;

// Run daily summary collection
$application = new Application();
$command = $container->get(GetDailySummaryCommand::class);
$application->addCommand($command);
$application->run();

use WechatMiniProgramStatsBundle\Repository\DailyPageVisitDataRepository;

// Get daily page visit data
$repository = $entityManager->getRepository(DailyPageVisitData::class);
$data = $repository->findBy(['date' => new \DateTime('2024-01-01')]);
bash
php bin/console doctrine:migrations:migrate
bash
# Daily statistics collection
php bin/console wechat-mini-program:get-daily-summary
php bin/console wechat-mini-program:get-daily-visit-trend
php bin/console wechat-mini-program:get-daily-retain

# Weekly and monthly trends
php bin/console wechat-mini-program:get-weekly-visit-trend
php bin/console wechat-mini-program:get-monthly-visit-trend

# Performance monitoring
php bin/console wechat-mini-program:performance-data:get
php bin/console wechat-mini-program:operation-performance:sync