PHP code example of pxlrbt / php-scoper-prefix-remover

1. Go to this page and download the library: Download pxlrbt/php-scoper-prefix-remover 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/ */

    

pxlrbt / php-scoper-prefix-remover example snippets




use pxlrbt\PhpScoper\PrefixRemover\IdentifierExtractor;
use pxlrbt\PhpScoper\PrefixRemover\RemovePrefixPatcher;

$identifiers = (new IdentifierExtractor())
  ->addStub('stub-file.php')
  ->extract();

'patchers' => [
    // Some patcher
    (new RemovePrefixPatcher($identifiers)),
    // More patchers

use pxlrbt\PhpScoper\PrefixRemover\IdentifierExtractor;

$identifiers = (new IdentifierExtractor())
  ->addStub('vendor/php-stubs/wordpress-stubs/wordpress-stubs.php')
  ->extract();

use pxlrbt\PhpScoper\PrefixRemover\IdentifierExtractor;
use PhpParser\Lexer\Emulative;

$identifiers = (new IdentifierExtractor())
    ->addStub('vendor/php-stubs/wordpress-stubs/wordpress-stubs.php')
    ->setLexer(new Emulative(['phpVersion' => '8.0']))
    ->extract();