Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Laravel Snippets SPNew to Visual Studio Code? Get it now.
Laravel Snippets SP

Laravel Snippets SP

SMIT_PATEL_SP

|
4 installs
| (0) | Free
Comprehensive Laravel snippets for VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Laravel Snippets for VS Code

A comprehensive collection of Laravel snippets for Visual Studio Code.

⚠️ Disclaimer ⚠️

This extension is not an official Laravel product. It is a third-party extension created to enhance the Laravel development experience in VS Code.

Credits

  • Laravel - The official Laravel framework
  • Visual Studio Code - Microsoft's code editor

Features

This extension provides snippets for both PHP and Blade templates, covering all major Laravel features and components.

PHP Snippets

  • lcontroller - Create a new controller
  • lmodel - Create a new model
  • lmigration - Create a new migration
  • lroute - Create a new route
  • lvalidation - Create validation rules
  • lfactory - Create a new factory
  • lseeder - Create a new seeder
  • lmiddleware - Create a new middleware
  • lservice - Create a new service
  • lrepository - Create a new repository
  • levent - Create a new event
  • llistener - Create a new listener
  • ljob - Create a new job
  • lnotification - Create a new notification
  • lpolicy - Create a new policy
  • lresource - Create a new API resource
  • lcollection - Create a new API resource collection
  • lrequest - Create a new form request
  • lcommand - Create a new command
  • ltest - Create a new test
  • leloquent - Create an Eloquent query

Blade Snippets

  • lcomponent - Create a new component
  • llayout - Create a new layout
  • lsection - Create a new section
  • linclude - Include a view
  • lextends - Extend a layout
  • lif - Create an if statement
  • lifelse - Create an if-else statement
  • lforeach - Create a foreach loop
  • lfor - Create a for loop
  • lwhile - Create a while loop
  • lcsrf - Add CSRF token
  • lmethod - Add method field
  • lerror - Display validation error
  • lold - Display old input
  • lauth - Check authentication
  • lguest - Check guest status
  • lrole - Check user role
  • lpermission - Check user permission
  • lcan - Check user ability
  • lcannot - Check user inability
  • lpush - Push to stack
  • lstack - Display stack
  • lslot - Create component slot
  • lattr - Merge component attributes
  • ldirective - Create custom directive
  • lphp - Add raw PHP
  • lunescaped - Output unescaped
  • lescaped - Output escaped
  • lcomment - Add comment
  • llang - Translate text
  • lchoice - Translate with choice
  • lconfig - Get config value
  • lenv - Get env variable
  • lsession - Get session value
  • lcookie - Get cookie value
  • lrequest - Get request value
  • lurl - Generate URL
  • lroute - Generate route URL
  • lasset - Generate asset URL
  • lmix - Generate Mix URL
  • lvite - Include Vite assets
  • lisset - Check if variable is set

Installation

  1. Open VS Code
  2. Press Ctrl+P to open the Quick Open dialog
  3. Type ext install laravel-snippets and press Enter
  4. Reload VS Code when prompted

Usage

Type the prefix of the snippet you want to use and press Tab or Enter. The available prefixes are listed above.

Examples

Creating a Controller

Type lcontroller and press Tab:

<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class NameController extends Controller
{
    public function index()
    {
        // Your code here
    }
}

Creating a Blade Component

Type lcomponent and press Tab:

<div>
    {{-- Component Name --}}
    // Your component content here
</div>

Contributing

We welcome your feedback and suggestions to improve these snippets.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you find any issues or have suggestions, please contact the extension author.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft