ihor-radchenko/laravel-ide-helper-macros 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ihor-radchenko/laravel-ide-helper-macros

Composer 安装命令:

composer require ihor-radchenko/laravel-ide-helper-macros

包简介

Generate phpDoc for laravel macroable class.

README 文档

README

It is advised to be used with Laravel IDE Helper, which generates helper files for your IDE, so it'll be able to highlight and understand some Laravel-specific syntax. This package can generate phpDocs for Laravel classes, based on Macroable trait.

Installation

Require this package with composer using the following command:

composer require --dev ihor-radchenko/laravel-ide-helper-macros

If you are using Laravel 5.4 or lower, you must register the IdeHelperMacrosServiceProvider manually.

Configuration

Run the following command to publish the configuration file to config/ide-helper-macros.php:

php artisan vendor:publish --provider="IhorRadchenko\LaravelIdeHelperMacros\IdeHelperMacrosServiceProvider"

Automatic phpDoc generation for Laravel Macroable classes

You need add macro or mixin in some service provider, example:

/**
 * Bootstrap services.
 *
 * @return void
 */
public function boot(): void
{
    /**
     * @param array $data
     *
     * @return \Illuminate\Http\Response
     */
    \Illuminate\Http\Response::macro('addContent', function (array $data) {
        /** @var \Illuminate\Http\Response $this */
        $response = $this;
        $content = json_decode($response->getContent(), true);
        if (is_array($content)) {
            $response->setContent(json_encode(array_merge($content, $data)));
        }

        return $response;
    });
}

And run the following command to generate the phpDocs IDE helpers:

php artisan ide-helper:macros

After that the following block will be generated in the \Illuminate\Http\Response class:

/**
 * Illuminate\Http\Response
 *
 * @method \Illuminate\Http\Response addContent(array $data)
 * @package ide_helper_macros
 */
class Response extends BaseResponse
{

统计信息

  • 总下载量: 622
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固