public function phar($opts = ['neuralyzer-version' => 'dev'])
    {
        if ((int)ini_get('phar.readonly') === 1) {
            throw new \RuntimeException(
                'You must have phar.readonly = 1 or run' . PHP_EOL .
                'php -d phar.readonly=0 vendor/bin/robo (phar|release)'
            );
        }
        // Create a collection builder to hold the temporary
        // directory until the pack phar task runs.Call to undefined method RoboFile::startProgressIndicator()
        $collection = $this->collectionBuilder();
        $workDir = $collection->tmpDir();
        $buildDir = "$workDir/neuralyzer";

        $prepTasks = $this->collectionBuilder();
        $preparationResult = $prepTasks
            ->taskFilesystemStack()
                ->mkdir($workDir)
                ->taskCopyDir([__DIR__ . '/src' => $buildDir . '/src'])
            ->taskFilesystemStack()
                ->copy(__DIR__ . '/bin/neuralyzer', $buildDir . '/bin/neuralyzer')
                ->copy(__DIR__ . '/composer.json', $buildDir . '/composer.json')
                ->copy(__DIR__ . '/composer.lock', $buildDir . '/composer.lock')
                ->copy(__DIR__ . '/LICENSE', $buildDir . '/LICENSE')
                ->copy(__DIR__ . '/README.md', $buildDir . '/README.md')

            ->taskComposerInstall()
                ->dir($buildDir)
                ->noDev()
                ->noScripts()
                ->printOutput(true)
                ->optimizeAutoloader()
                ->run();

        // Exit if the preparation step failed
        if (!$preparationResult->wasSuccessful()) {
            return $preparationResult;
        }

        $currentVersion = \Edyan\Neuralyzer\Console\Application::VERSION;
        $this->say("Setting version number to {$opts['neuralyzer-version']}");
        $this->taskReplaceInFile($buildDir . '/src/Console/Application.php')
             ->from("const VERSION = '$currentVersion';")
             ->to("const VERSION = '{$opts['neuralyzer-version']}';")
             ->run();

        $this->say("Force Robo to compress up to 1500 files in a phar");
        $this->taskReplaceInFile(__DIR__ . '/vendor/consolidation/robo/src/Task/Development/PackPhar.php')
             ->from('if (count($this->files) > 1000)')
             ->to('if (count($this->files) > 1500)')
             ->run();


        // Decide which files we're going to pack
        $files = \Symfony\Component\Finder\Finder::create()
            ->ignoreVCS(true)
            ->files()
            ->name('*.php')
            ->name('*.exe') // for symfony/console/Resources/bin/hiddeninput.exe
            ->path('src')
            ->path('vendor')
            ->notPath('docs')
            ->notPath('/vendor\/.*\/[Tt]est/')
            // incomplete and need to reduce for phar compression
            //->notPath('ro_MD')
            //->notPath('sr_Cyrl_RS')
            //->notPath('sr_Latn_RS')
            ->in(is_dir($buildDir) ? $buildDir : __DIR__);

        $fakerLang = \Symfony\Component\Finder\Finder::create()
            ->ignoreVCS(true)
            ->files()
            ->name('*')
            ->path('src/Faker/Dictionary')
            ->in(is_dir($buildDir) ? $buildDir : __DIR__);

        // Build the phar
        return $collection
            ->taskPackPhar('neuralyzer.phar')
                ->compress()
                ->addFile('bin/neuralyzer', 'bin/neuralyzer')
                ->addFile('config/services.yml', 'config/services.yml')
                ->addFiles($files)
                ->addFiles($fakerLang)
                ->executable('bin/neuralyzer')
            ->taskFilesystemStack()
                ->chmod(__DIR__ . '/neuralyzer.phar', 0755)
            ->run();
    }