arokettu/phpstorm-metadata-export

从DI容器中导出PhpStorm高级元数据

3.0.1 2024-07-28 20:18 UTC

README

Packagist license Code Climate Gitlab pipeline status Codecov

从DI容器中导出PhpStorm高级元数据以启用代码补全。

该库受到Pimple Container Dumper的启发,用于Silex,但它不需要IDE插件,因为它使用的是原生的PhpStorm导出格式。它可以与任何PSR-15兼容的框架集成,并且可以扩展以支持更多DI容器和框架。

安装

通过composer安装

composer require arokettu/phpstorm-metadata-export --dev

容器支持

支持的容器

中间件集成

示例

<?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