Stay updated...

Category: Laravel

10 awesome extensions VSCode for Laravel/PHP

10 Awesome VS Code Extensions for PHP/Laravel Developers

We all know how text editors are very important to us when we code, for everyone who is getting started with Laravel.

Below, are my list of the Top 10 extensions I recommend for all Laravel/PHP developers, which will help you expand your productivity.

1. Laravel Artisan

We all use the VS Code terminal to run artisan commands and that is great but using the Laravel Artisan Extension you can run the artisan commands from within VS Code directly.

Get a List of Route
Make controller

Some of the main features are:

  • Make files (Controllers, Migrations, Models, etc)
  • Run Custom Commands
  • Manage the database
  • Clear Caches
  • Generate Keys
  • View all routes
  • Start/stop a local PHP server for test purposes

Laravel Artisan on VS Code

2. Laravel Blade Snippets

Laravel Blade Snippets extensions add syntax highlight support

Laravel blade support

Some of the features are

  • Blade syntax highlight
  • Blade snippets
  • Emmet works in blade template
  • Blade formatting

After that is done, there is some other stuff to be done for the extension to work properly. Go to File -> Preferences -> Settings and add this to your settings.json

"emmet.triggerExpansionOnTab": true, // enable tab to expanse emmet tags
"blade.format.enable": true,         // if you would like to enable blade format
"[blade]": {
    "editor.autoClosingBrackets": "always"
},

For more information on how to use the Laravel Blade Snippets make sure to your check here documentation here.

Laravel Blade Snippets on VS Code

3. Laravel Blade Spacer

Laravel blade spacer helps to automatically add spacing to blade templating markers.

Laravel Blade Spacer

Supports the following tags

  • {{ }}
  • {!! !!}
  • {{-- --}}

Laravel Blade Spacer

4. Laravel Extra Intellisense

Laravel Extra Intellisense provides Laravel route, views and autocompletes for VS Code

Route names and route parameters

Some of the autocomplete features are

You can also check the documentation on how to set it up.

Laravel Extra Intellisense

5. Laravel goto view

This is one of my favourite extensions when developing in Laravel, this extension helps you go to a particular view when clicked.

how to use

How to use this extension

You can use Ctrl or Alt + click to jump to the first matched Blade View file

Laravel goto View on VS Code

6. DotENV

DotENV extensions helps a lot in VS Code .env sytnax highlighting

DotENV Sample

You can check DotENV documentation for more information.

DotENV on VS Code

7. Laravel Snippets

Laravel snippets extension for VS Code Support Laravel 5 and above, this snippet provides prefix follows Laravel Facades for example Route:: Request::

Support Snippets Prefix

  • Auth
  • Broadcast
  • Cache
  • Config
  • Console
  • Cookie

Browse the documentation for more about the Laravel Snippets extensions

8. Laravel goto controller

As your application grows, the number of your Controllers grows as well, so at some point, you might end up with hundreds of controllers. Hance finding your way around might get tedious.

This is the exact problem that the Laravel-goto-controller VScode extension solves.

The extension allows you to press Alt + click on the name of the controller in your routes file, and it will navigate you from the route to the respective controller file:

Laravel goto controller

For more information, make sure to check the documentation here:

VSCode extension for Laravel

9. PHP Namespace Resolver

PHP Namespace Resolver can import and expand your class. You can also sort your imported classes by line or in alphabetical order.

PHP namespace resolver

For more details, you can check the online documentation on more configurations

PHP Namespace Resolver on VS Code

10. PHP Formatter

After installing as an extension with Visual Studio Code, this extension automatically formats your PHP code, in accordance with PSR-0, PSR-1, PSR-2 or Symfony style conventions.

PHP formatter

Some of the features are:

  • Format current selection only, or the whole file.
  • Trigger formatting with custom keybindings or actions.
  • Supports formatting on save.
  • Supports adjustable level (i.e. PSR2) and fixers.
  • Can be configured to support other file extensions than PHP as well, i.e. “.inc” files.
  • Supports different PHP-CS-Fixer installation methods, i.e. Composer vs manual installation.

For more on how to set up and use the PHP formatter on VS Code, you can go through the online documentation

PHP Formatter on VS Code

Conclusion

If you like all those extensions, you can take a look at the Laravel Extension Pack on VS Code, where you could get all of the mentioned extensions as 1 bundle!

The only extension not included in the pack is the Laravel Blade Spacer, so make sure to install it separately!

I hope that this helps!

How to upload your Laravel Website on Cpanel

In this article, I will be sharing with you how you can publish your Laravel website on Cpanel.

With these few steps, you will be able to have your site fully functional online, You can also watch the video above for a virtual practice.

1. Compress Laravel files

Compress all your files

Laravel Project files

2. Upload on Cpanel

Upload the compressed files to the directory your site is located.

Uploaded laravel project

3. Extract files

Next, all you have to do is to extract the files

Extract files

4. Create a folder called Core

At the top left corner, you can create a new folder, for the sake of this tutorial we will call this folder core.

Create New Folder

5. Move all files

Now that we have our core folder, we can select all files (except the core folder we just created) and move them all into the core folder.

move into core

6. The Public folder

Next, we move into the public folder which is now inside the core folder. Our public folder will look something like this depending on what it contains.

public folder

All we have to do is to select all the files and move them to the root folder of our directory. The root folder (or root directory) is the top-level directory of a file system. Now we will have this on our root folder.

the root folder

Lastly, one final step finishing everything up. All we have to do is to open the index.php page by right-clicking and then click on the edit option.

index.php

Now, you have a live editor open. All you have to do is change the files directory to the new location we now have.

They are three(3) lines of code we have to change.

if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
    require $maintenance;
}

It will be changed to

if (file_exists($maintenance = __DIR__.'/core/storage/framework/maintenance.php')) {
    require $maintenance;
}

Next

require __DIR__.'/../vendor/autoload.php';

It will be changed to

require __DIR__.'/core/vendor/autoload.php';

Lastly

$app = require_once __DIR__.'/../bootstrap/app.php';

changed to

$app = require_once __DIR__.'/core/bootstrap/app.php';

You will notice all we just did was just add the core folder.

Oh yeah. test your site now. You can see your site is now live.

Have any questions, you can leave is below the comment section, I will be very happy to help.

Thanks.

Powered by WordPress & Theme by Anders Norén