alfredbez/oxid-dump-autoload
Composer 安装命令:
composer require alfredbez/oxid-dump-autoload
包简介
README 文档
README
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 27.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-11-20