alfredbez/oxid-dump-autoload 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

alfredbez/oxid-dump-autoload

Composer 安装命令:

composer require alfredbez/oxid-dump-autoload

包简介

README 文档

README

codecov

Description

Sometimes it's helpful to have the module-chain which is saved in the oxid database in a simple php file on the disk, e.g. for running static code analysis or to tell your IDE where to find a *_parent class. This little Tool allows you to generate a php-file which consinst of all class_alias statements used inside the shop.

Could be used for example in phpstan like this:

$ cat phpstan.neon
parameters:
    level: 0
    autoload_files:
    scanFiles:
    - %currentWorkingDirectory%/source/oxfunctions.php
    - %currentWorkingDirectory%/source/overridablefunctions.php
    bootstrapFiles:
    - %currentWorkingDirectory%/vendor/oxid-esales/oxideshop-ce/source/Core/Model/BaseModel.php
    - %currentWorkingDirectory%/.autoload.oxid.php

Make sure to use bootstrapFiles since the file contains a list of class_alias() statements.

Usage example for psalm:

$ cat .autoload.php
<?php

require_once 'vendor/autoload.php';
require_once '.autoload.oxid.php';
$ cat psalm.xml
<?xml version="1.0"?>
<psalm
    errorLevel="6"
    resolveFromConfigFile="true"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="https://getpsalm.org/schema/config"
    xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
    autoloader=".autoload.php"
>
    <projectFiles>
        <directory name="." />
        <ignoreFiles>
            <directory name="vendor" />
            <file name="metadata.php" />
        </ignoreFiles>
    </projectFiles>
</psalm>

Installation

composer require --dev alfredbez/oxid-dump-autoload

Usage

vendor/bin/oxid-dump-autoload --help shows you the general usage info.

To generate a autoload.oxid.php inside your current working directory add -p autoload.oxid.php to the command.

Options

Source

The script uses the class-chain from the shop as default, but you can also generate the autoload-files for a module by specifying a path to the metadata.php:

vendor/bin/oxid-dump-autoload --source path/to/my/module/metadata.php

Filter

You can filter classes from the chain like so:

vendor/bin/oxid-dump-autoload --filter oe/,ddoe/

Specifying a shop-id

vendor/bin/oxid-dump-autoload --shopid 5

Write to a file instead of STDOUT

vendor/bin/oxid-dump-autoload -p .autoload.oxid.php
vendor/bin/oxid-dump-autoload > .autoload.oxid.php # basically the same

Provide path to bootstrap.php

If the script is not able to find the shops bootstrap.php you can provide the path via the environment variable BOOTSTRAP_PATH:

BOOTSTRAP_PATH=$(pwd)/source/bootstrap.php vendor/bin/oxid-dump-autoload

alfredbez/oxid-dump-autoload 适用场景与选型建议

alfredbez/oxid-dump-autoload 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27.37k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 alfredbez/oxid-dump-autoload 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 alfredbez/oxid-dump-autoload 我们能提供哪些服务?
定制开发 / 二次开发

基于 alfredbez/oxid-dump-autoload 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 27.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-11-20