vscode-laravel-extra-intellisense

amir9480MIT活跃维护

为 VSCode 中的 Laravel 项目补上框架层面的自动补全,让模型属性、配置项和路由等不再靠记忆手写。

This extension adds extra autocompletion for laravel projects to VSCode.

暂无版本4,228star59fork同步于 2026-11-11 05:36 UTC

怎么上手

由 README 提炼,执行前请确认
在 VSCode 扩展市场安装 Laravel Extra Intellisense;Docker 环境需配置 "LaravelExtraIntellisense.phpCommand" 与 "LaravelExtraIntellisense.basePathForCode"
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

给 VSCode 的 Laravel 项目补全路由、视图、配置等,让 Blade 里也能自动补全

为 VSCode 中的 Laravel 项目补上框架层面的自动补全,让模型属性、配置项和路由等不再靠记忆手写。

核心能力

  • 补全路由名称与路由参数
  • 补全视图名、视图变量与 section/stack
  • 补全 config、translation 及翻译参数
  • 补全 validation 规则与 env 变量
  • 补全 mix/vite 函数、asset 与路由中间件

容易踩的坑

扩展会周期性自动运行你的 Laravel 应用来取数据,service provider 里有敏感代码时建议临时禁用;项目不在根目录时要设 basePath,Docker 下还要设 basePathForCode 和 phpCommand;模型属性补全为 Beta,视图里的变量类型需用 modelVariables 手动声明

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    This extension provides Laravel routes, views and ... autocomplete for VSCode.

    Please read the security note and how to configure before using the extension.

    Autocomplete

    Route names and route parameters

    Routes

    Views and variables

    Views

    Configs

    Configs

    Translations and translation parameters

    Translations

    Laravel mix and vite functions

    Mix

    Validation rules

    Validation rules

    View sections and stacks

    View sections

    Env

    env

    Route Middlewares

    Middlewares

    Configuration

    LaravelExtraIntellisense.customValidationRules:

    Your custom validation rules snippets.

    Example:

    "LaravelExtraIntellisense.customValidationRules": {
        "mobile": "mobile",
        "distance_gt": "distance_gt:${0:1km}"
    }
    

    LaravelExtraIntellisense.phpCommand

    Command to run PHP codes to interact with your Laravel application.

    Default: php -r \"{code}\"

    Note: {code} is PHP code generated by extension and should be wrapped with "".

    LaravelExtraIntellisense.basePath

    Base path of your Laravel application. useful if your Laravel project is not at the root of you project directory.

    If the base path starts with . (like ./src) it will be considered a relative path otherwise it will be considered an absolute path.

    LaravelExtraIntellisense.basePathForCode

    Same as LaravelExtraIntellisense.basePath but this one using for require_once in generated PHP codes.

    LaravelExtraIntellisense.viewDirectorySeparator

    You also can use / instead of . as directory separator for view autocomplete.

    LaravelExtraIntellisense.modelsPaths

    Array of paths including your models. (Default: ["app", "app/Models"])

    LaravelExtraIntellisense.modelVariables

    Variable names that should provide autocomplete with specific model class. Finding variable type (especially in views) is not easy so you need to manually define variable types.

    Example: The Following setting provides auto completion each time you type discountedProduct-> with App\Models\Product model attributes.

    "LaravelExtraIntellisense.modelVariables": {
        "discountedProduct": "App\\Models\\Product"
    }
    

    All camelCase and snake_case of model names provide autocomplete by default. For example productDiscount and product_discount provides member autocomplete from App\Models\ProductDiscount model.

    LaravelExtraIntellisense.modelAttributeCase

    Change model attribute names case to snake_case, camelCase or default. (Default = default)

    LaravelExtraIntellisense.modelAccessorCase

    Change model accessor names case to snake_case, camelCase or default. (Default = snake)

    LaravelExtraIntellisense.disableBlade

    If you want to disable blade directives autocomplete set this to true.

    LaravelExtraIntellisense.disableAuth

    If you want to disable authorization autocomplete set this to true

    LaravelExtraIntellisense.disableErrorAlert

    Hide error alerts when extension can't get data from your application.

    Sample config to use docker

    This is a simple configuration to use via Laradock.

    "LaravelExtraIntellisense.phpCommand": "docker exec -w /var/www/your-project -u laradock laradock_workspace_1 php -r \"{code}\"",
    "LaravelExtraIntellisense.basePathForCode": "/var/www/your-project"
    

    Another sample for Laravel Sail.

    "LaravelExtraIntellisense.basePathForCode": "/var/www/html",
    "LaravelExtraIntellisense.phpCommand": "docker-compose exec -w /var/www/html YOUR_SERVICE_NAME php -r \"{code}\""
    

    Default YOUR_SERVICE_NAME for Laravel sail is laravel.test.

    It is possible to use this extension with other docker images or even other virtual machines.

    Security Note

    This extension runs your Laravel application automatically and periodically to get the information needed to provide autocomplete.

    So if you have any unknown errors in your log make sure the extension not causing it.

    Also if you writing any sensitive code in your service providers, disable the extension temporarily to prevent unwanted application executing.

    Release Notes

    0.6.x

    • Add blade directives autocomplete (#45).
    • Add change case option for model attributes (#46).
    • Add support workspace with multiple directory (#54).
    • Add nested translations support (#54).
    • Add Vite autocompletion support (#131)

    0.5.x

    • Add asset support.
    • Add Model attributes autocomplete (Beta).

    0.4.x

    • Add Docker support.

    0.3.x

    • env autocomplete added.
    • Route middleware autocomplete added.
    • Nested stack and section support added.
    • Function parser improvement.
    • Performance improvement.
    • Bug fixes (#25, #26)
    • Add configuration for views separator (#22).
    • can, cannot autocomplete.
    • Fix #18.

    0.2.x

    • Validation rules autocomplete added.
    • works with Validator class, validate functions and inside request classes.
    • markdown function added to view functions for autocomplete.
    • Using file watcher instead of save event. Better change detect for view autocomplete.
    • json translation autocomplete added.
    • Auto-Retry removed from all providers. causes some performance issues.
    • Disable logging added.
    • View parameters autocomplete.
    • Route autocomplete bug in linux fixed.
    • Blade section autocomplete added.
    • Blade stack autocomplete added.
    • Duplicate section autocomplete items fixed.
    • PHP commands converted to async functions to prevent unresponsive extension host error.

    0.1.x

    • Fix problems with linux.
    • Add translation autocomplete.
    • Improved providers.
    • Add mix autocomplete.
    • Performance improvments.
    • Route action autocomplete added. Route::get, *Route::post, ... autocompletes controller actions inside app\Http\Controllers.

    0.0.x

    • Config autocomplete added.
    • Route bug fix.
    • View names with namespaces ready to use.
    • View functions autocomplete added.
    • Blade bug fix.
    • Add route autocomplete.

    Recommended extensions

    Credits