setasign/php-stub-generator
Composer 安装命令:
composer require setasign/php-stub-generator
包简介
A tool to generate stub-files for your php classes.
README 文档
README
A tool to generate stub-files for your php classes.
The main purpose for this tool is to generate stub-files from php classes to have code completion for your IDE when encrypting your library with e.g. the ioncube encoder.
Installation
A basic installation via Composer could be done this way:
composer require setasign/php-stub-generator
Composer will install the tool to your project's vendor/setasign/php-stub-generator directory.
Basic usage
<?php declare(strict_types=1); use setasign\PhpStubGenerator\PhpStubGenerator; use setasign\PhpStubGenerator\Reader\AllFiles; require_once __DIR__ . '/vendor/autoload.php'; $generator = new PhpStubGenerator(); $generator->addSource( 'setapdf-core', new AllFiles(__DIR__ . '/vendor/setasign/setapdf-core/library') ); $output = $generator->generate(); file_put_contents(__DIR__ . '/setapdf-core-stub.php', $output);
Alternatively you could just call the cli helper.
vendor/bin/php-stub-generator generate setapdf-core/library setapdf-core-stub.php
Settings
The PhpStubGenerator class has following settings:
class PhpStubGenerator { /** * End of line character(s). * * Doesn't change the used EOL character(s) of doc blocks. * * @var string */ public static $eol = "\n"; /** * Tab character(s) * * @var string */ public static $tab = ' '; /** * If enabled all generated class constants get a visibility (the generated stubs require PHP >= 7.1) * * Within the cli tool can be set with the option "--addClassConstantsVisibility" * * @var bool */ public static $addClassConstantsVisibility = false; /** * If false the interface \Stringable won't be filtered out (the generated stubs require PHP >= 8.0). * * Within the cli tool can be set with the option "--includeStringable" * * @var bool */ public static bool $includeStringable = false; }
Drawbacks
- Calculated constants or constants that use other constants like __DIR__ will be filled with the values of the runtime environment.
- Global Functions and Constants are currently ignored
setasign/php-stub-generator 适用场景与选型建议
setasign/php-stub-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.12k 次下载、GitHub Stars 达 30, 最近一次更新时间为 2017 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 setasign/php-stub-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 setasign/php-stub-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 30
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-22