Download the PHP package chinaphp/yii2-ide-helper without Composer

On this page you can find all versions of the php package chinaphp/yii2-ide-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-ide-helper

Yii2 IDE Helper

为 Yii2 框架提供 PhpStorm 智能代码补全支持,灵感来源于 barryvdh/laravel-ide-helper

Latest Stable Version Total Downloads License

功能特性

安装

要求

使用 Composer 安装

配置

在 console/config/main-local.php 中添加以下配置(仅本地开发环境需要):

使用

生成组件类型提示

这将生成 _ide_helper.php 文件,包含所有 Yii2 组件的类型提示。

生成的内容:

生成 ActiveRecord 模型类型提示

这将扫描 ActiveRecord 模型并生成属性和关系类型提示。

生成的内容:

生成 PhpStorm Meta 文件

这将生成 .phpstorm.meta.php 文件,为依赖注入容器提供类型推断。

生成的内容:

查看帮助

PhpStorm Meta 文件详解

.phpstorm.meta.php 文件为 PhpStorm 提供高级类型推断能力,以下是它支持的功能:

1. DI 容器类型推断

这个配置告诉 PhpStorm,Yii::$app->get('db') 的返回类型是 \yii\db\Connection。

使用示例:

2. 组件属性类型提示

这个配置告诉 PhpStorm,Yii::$app->db 属性的类型是 \yii\db\Connection。

使用示例:

3. ActiveRecord 查询类型

这个配置告诉 PhpStorm,ActiveRecord::find() 返回 ActiveQuery 类型。

使用示例:

4. 自定义绑定

你可以在代码中添加自定义绑定:

配置文件示例:

PhpStorm 配置

  1. 在 PhpStorm 中打开项目
  2. 导航到 Settings > PHP > Include paths
  3. 添加 _ide_helper.php 文件路径
  4. 如果有 .phpstorm.meta.php,确保它在项目根目录
  5. 重新索引项目(File > Invalidate Caches / Restart)

生成文件示例

_ide_helper.php

_ide_helper_models.php

.phpstorm.meta.php

Meta 文件优势:

测试

运行测试套件:

运行代码规范检查:

贡献

欢迎提交 Pull Request!

许可证

MIT License

致谢

本项目灵感来源于 barryvdh/laravel-ide-helper


All versions of yii2-ide-helper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
nikic/php-parser Version ^4.18
phpdocumentor/reflection-docblock Version ^5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chinaphp/yii2-ide-helper contains the following files

Loading the files please wait ...