arokettu / phpstorm-metadata-export
从DI容器中导出PhpStorm高级元数据
3.0.1
2024-07-28 20:18 UTC
Requires
- php: ^7.2 | ^8.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- laminas/laminas-servicemanager: ^3.0 | ^4.0
- php-di/php-di: ^6.0 | ^7.0
- phpunit/phpunit: >= 7 < 10
- pimple/pimple: ^3.0
- psy/psysh: *
- sandfox.dev/code-standard: ^1
- slim/slim: ^3.0
- squizlabs/php_codesniffer: *
- symfony/polyfill-php80: ^1.23
- vimeo/psalm: ^4.30 | ^5.4
README
从DI容器中导出PhpStorm高级元数据以启用代码补全。
该库受到Pimple Container Dumper的启发,用于Silex,但它不需要IDE插件,因为它使用的是原生的PhpStorm导出格式。它可以与任何PSR-15兼容的框架集成,并且可以扩展以支持更多DI容器和框架。
安装
通过composer安装
composer require arokettu/phpstorm-metadata-export --dev
容器支持
支持的容器
- Pimple (v3)
- PHP-DI (v6, v7)
- Laminas ServiceManager (v3, v4;永久不稳定)
中间件集成
示例
<?php $container = new \DI\Container(); // .phpstorm.meta.php must be in a root path of your project $storePath = __DIR__ '/.phpstorm.meta.php/sandfox_container_export.meta.php'; // just generate the file content $metaPhp = \Arokettu\PhpStorm\Metadata\Generator::get([$container]); file_put_contents($storePath, $metaPhp); // use middleware (Slim 4 example) $app = new \Slim\App(); $app->addMiddleware(new \Arokettu\PhpStorm\Metadata\Integration\ContainerExportMiddleware($container, [ 'filename' => $storePath, ]));
文档
在https://sandfox.dev/php/metadata-exporter-phpstorm.html中阅读完整文档
也在Read the Docs上:https://phpstorm-metadata-export.readthedocs.io/
支持
请在GitLab的主要仓库中提交问题:https://gitlab.com/sandfox/phpstorm-metadata-export/-/issues
欢迎在我们的Gitter房间中提问:https://gitter.im/arokettu/community
许可证
该库在MIT许可证的条款下作为开源软件提供。请参阅LICENSE.md。