承接 pxlrbt/php-scoper-prefix-remover 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pxlrbt/php-scoper-prefix-remover

Composer 安装命令:

composer require pxlrbt/php-scoper-prefix-remover

包简介

README 文档

README

PHP-Scoper Patcher for removing prefixes from global functions/classes/traits.

Installation

composer require --dev pxlrbt/php-scoper-prefix-remover

Usage

Import the required classes either manually or via composer autoloader:

require __DIR__ . '/vendor/autoload.php';

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

Extract the functions/classes/traits/interfaces you want the prefix removed from a stub file:

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

Add the patcher in the patcher section of PHPScoper and pass the identifiers you extracted earlier:

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

WordPress

For removing prefixes from WordPress functions/classes install WordPress stubs.

composer require --dev php-stubs/wordpress-stubs

Then add the stubs file to the extractor:

use pxlrbt\PhpScoper\PrefixRemover\IdentifierExtractor;

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

Specific PHP version

There might be issues with new reserved keywords (e.g. readonly as new keyword in PHP 8.1 and WordPress function name). You can set the targeted PHP version by providing a non default lexer like this:

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();

统计信息

  • 总下载量: 1.62k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-10-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固