Skip to content
プロジェクト

概要

Laravel Language Server written in go.

Web・アプリ開発

この数値の測り方

できること

  • Livewire support
  • Inertia support
  • Eloquent support
  • Jump to test file from class.

計測したスター増加

24時間
0
7日間
0
15日間
-1
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Laravel-ls

Laravel Language Server written in go.
About | Features | Install | Building | Configuration

Go Version License Test Release

About

Laravel-ls is a tool that enhances your text editor or IDE with powerful features specifically designed for Laravel projects.

By implementing the Language Server Protocol (LSP), Laravel-ls seamlessly integrates with any LSP-compatible editor, bringing advanced capabilities such as intelligent auto-completion, navigation to definitions, real-time diagnostics, and more.

Although still in its early development stages, Laravel-ls aims to provide a streamlined and efficient development experience tailored to the Laravel framework.

Features

List of done and planned features of the language server.

Views

view('home')
Route::view('/user/profile', 'user.profile')
  • Hover information shows view template path.
  • Go to definition opens the template
  • Auto-complete existing template names
  • Auto-complete for existing arguments present in the template
  • Diagnostics for template files that do not exists
  • Code action to create view file that do not exists.

Routes

route('dashboard');
redirect()->route('dashboard');
URL::route('dashboard');
  • Hover information shows route definition
  • Inline hints show resolved controller actions
  • Go to definition
  • Auto-complete existing route names
  • Auto-complete route arguments
  • Diagnostics for routes that do not exists
  • Code action to create a new route if route do not exists.

Environment

env('APP_NAME');
Env::get('APP_NAME');
  • Hover information shows actual value from .env file
  • Go to .env file and key location
  • Auto-complete for defined keys.
  • Diagnostics for non defined keys.
  • Code action to create missing key

Config

config('app.name')
config()->string('app.name')
config()->getMany(['app.name'])
Config::get('app.name')
Config::getMany(['app.name'])
  • Hover information shows actual value.
  • Auto-complete for defined config keys
  • Go to config file and value location from key
  • Diagnostics for non defined config keys.

Application bindings

app('db.connection')
app()->make('db.connection')
app()->bound('db.connection')
app()->isShared('db.connection')
app()->make('db.connection')
app()->bound('db.connection')
app()->isShared('db.connection')
  • Hover information shows value.
  • Auto-complete for defined bindings
  • Go to location where binding is defined
  • Diagnostics for non defined bindings

Assets

asset('main.css');
  • Auto-completion
  • Go to asset file
  • Diagnostics for non existent assets

Blade components

<x-component.name />
<x-component name="dynamic-component" />
  • Hover information show path to the component
  • Auto-complete existing components
  • Auto-complete arguments defined in the component
  • Diagnostics for components that do not exists.
  • Code action to create missing components

Other features on the horizon

  • Livewire support
  • Inertia support
  • Eloquent support
  • Jump to test file from class.

Install

Prerequisite

The LSP server requires php 8.3+ installed on the system and available in $PATH. For projects using laravel sail this is not needed as the lsp server will use the binary located inside the sail docker container.

Download via github

Official binaries for Windows, Linux and MacOS are provided on each github release

Just download the program and make sure its located somewhere in your $PATH

Example command to download:

sudo wget -O /usr/local/bin/laravel-ls https://github.com/laravel-ls/laravel-ls/releases/download/<VERSION>/laravel-ls-<VERSION>-linux-amd64 & \
   sudo chmod 755 /usr/local/bin/laravel-ls

Install via go

The program can be compiled and installed via go:

go install github.com/laravel-ls/laravel-ls/cmd/laravel-ls@latest

And if you have added GOPATH to your shell's PATH. You should be able to just run the server with:

laravel-ls

See the official documentation of go install

Mason (neovim)

The lsp can be installed using mason if you prefer that.

Build

To build the project you need golang version 1.23 or later, make and a c compiler.

The project officially supports building Windows and Linux binaries. But some users have had success on MacOS.

When the dependencies are met, running make will compile and produce the binary build/laravel-ls.

Configure your editor

Configuration

There are numerous ways to configure the LSP server.

Config file

laravel-ls loads optional configuration from either:

  • current working directory (.)
  • --basePath directory (default ~/.local/laravel-ls)

The config uses these keys:

log:
    filename: log
    level: info
  • log.filename: log file name relative to basePath
  • log.level: one of panic, fatal, error, warning, info, debug, trace

CLI parameters

CLI flags and config file values are mapped to the same settings. If both are set, use CLI flags to override the config file.

--basePath string    base path (default "~/.local/laravel-ls")
--log string         Log file, relative to basePath (default "log")
--log-level string   Logging level, one of: [panic fatal error warning info debug trace] (default "info")
-v, --version        show version
-h, --help           show help

Example:

laravel-ls --basePath "$HOME/.config/laravel-ls" --log laravel-ls.log --log-level debug

Author

Henrik Hautakoski [email protected]

関連プロジェクトを探す

読み込み中…