PHP code example of ytsoni / php-migrater

1. Go to this page and download the library: Download ytsoni/php-migrater 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/ */

    

ytsoni / php-migrater example snippets



return [
    'source' => '5.6',
    'target' => '8.1',
    'paths' => ['src', 'lib'],
    'exclude' => ['vendor', 'tests'],
    'parallel' => 4,
];


return [
    // Required: source and target PHP versions
    'source' => '5.6',
    'target' => '8.1',

    // Paths to analyze (relative to project root)
    'paths' => ['src'],

    // Directories to exclude
    'exclude' => ['vendor', 'tests', 'cache'],

    // Report output directory
    'report_output' => 'report',

    // Generated test output directory
    'test_output' => 'tests/migration',

    // Number of parallel workers (1 = sequential)
    'parallel' => 1,

    // Plugin classes to load
    'plugins' => [],

    // Web GUI port
    'web_port' => 8484,

    // State file for resume support
    'state_file' => '.php-migrater-state.json',
];

use Ylab\PhpMigrater\Plugin\PluginInterface;

class MyPlugin implements PluginInterface
{
    public function getName(): string { return 'my-plugin'; }
    public function getAnalyzers(): array { return [new MyAnalyzer()]; }
    public function getFixers(): array { return []; }
    public function getTestGenerators(): array { return []; }
    public function getReporters(): array { return []; }
}

'plugins' => [MyPlugin::class],
bash
composer 
bash
cp vendor/ytsoni/php-migrater/php-migrater.php.dist php-migrater.php
bash
vendor/bin/php-migrater analyze
bash
vendor/bin/php-migrater test:generate
json
{
    "extra": {
        "php-migrater": {
            "plugins": ["MyPlugin"]
        }
    }
}