SoengSouy.Webdesign Is a free online learning program that introduces methods and how to coding websites from the limit First, to the highest level. Extension for Visual Studio Code - Automatically add spaces in Laravel Blade template tags.
Laravel is a well-respected and popular PHP framework. As you might have read before, it aims to facilitate many of the common tasks of the majority of projects, while also strengthening security and database migration. That’s why many developers are convinced that Laravel provides one of the most reliable and efficient approaches to building a website. In this tutorial, you will learn how to install Laravel for Visual Studio Code from scratch.
Update: You can check Visual Studio tutorial here since lot of work mentioned in this article is done for you.
Installation
Visual Studio Laravel Download
1) Install Visual Studio Code.
You can download Visual Studio Code (VS Code) directly from its download page. For a detailed setup guide, click here. If you have it already installed, you can just ignore this step. If your using Visual Studio (instead of VS Code), PHP Tools will do this step for you.
Visual Studio Laravel Blade
2) Install Composer
Before you install Laravel, you need to get Composer. Composer is a tool that helps with dependency management in PHP. It allows installing and updating different components for the framework, and it manages all libraries and dependencies in one place. So, in order to work on Laravel, it is necessary to have Composer already on your system. You can download it from this page: https://getcomposer.org/download/
You can check whether Composer was installed by typing the word “composer” on the command prompt. You should see something like this:
3) Create a directory for your project.
Now, you need to create a directory for your new Laravel project. This step might take some time, depending on the speed of your internet. You can create a directory anywhere in your system and then use the command prompt to go to that directory with the following command:
4) Start Laravel
Laravel comes with Artisan. Artisan is a command-line interface (CLI) and one of the most important components of Laravel. When you downloaded the framework from the server on step 3, Laravel’s Artisan CLI was installed automatically. You don’t need to install it separately.
Artisan is a very helpful tool: it provides a series of commands that will assist you in developing your app. Basically, it minimizes the creation of manual tasks, because each command will create them for you. Just by running a command, you can create controllers and modes, database migration files (and then run those migration files), providers, events, jobs, form requests, session commands, and your own custom commands. Artisan will also show the available routes, run Tinker (a tool to interact with the database), and more.
To start Laravel, run this command:
You should see a screen with the following line: Laravel development started on
plus a URL.
5) Open the URL on your browser.
Copy the URL from the previous step and open it on your browser. The following image is what you should see when Laravel has been installed successfully.
6) Open Laravel on Visual Studio Code
In order to open Laravel and start building your app, you need Visual Studio Code
. Just follow these simple steps:
Search for
Visual Studio Code
in the start menu.Open
Visual Studio Code
.Click
File
on the Menu bar and chooseOpen Folder
Open Laravel by choosing the folder that you created on Step 3.
After opening Laravel, you should see the following folders and files:
Configuration
After you have successfully installed Laravel on Visual Studio Code, everything should work just fine. However, there’s a configuration option that you always need to set- your unique application key.
In order to have your own unique application key, you need to run the command below on the command prompt (before executing this command, make sure you’re in the root directory of the Laravel application):
As you can see on the above picture, after you run the command for generating your key, there’s a line that tells you that the application key has been set successfully. Save the file and you should be ready to start building your new app. For a more detailed explanation of other Laravel configurations, click here.
Vs Code Intellisense
In this tutorial, we have learned how to install Laravel for Visual Studio Code. Laravel will help you build more efficient and reliable sites. You’ll see that once you get to know it and have worked with it for a while, Laravel makes PHP fun. It’s a framework that will definitely stick around for the years to come.
You might also want to read:
In this blog post I would like to demonstrate how to install Laravel in Visual Studio. I will use new project wizard which we have in PHP Tools for Visual Studio.
Our goal here was to make this experience as simple as possible. The Laravel framework has certain requirements that you should install and configure first. But instead of googling the tutorial (like this one ;-) ). You should be able achive all of that just with few clicks directly in Visual Studio.
Creating Laravel Project
1. Click Create a new project
2. Select PHP and choose PHP Web Project
3. Name the project
4. Select Laravel template
I've PHP 8.0 for this project, which I don't yet have on my machine (Of course I do and you should too, but I just deleted it for this demo :-) ). I've checked Common Project System (VS 2019 only!), because it's much better than previous project system we've used since VS2010, even in it's current experimental state.
5. Wait
UAC will asks for permissions to continue. Accept and then wait so PHP Tools will do the work like downloading/updating Composer, installing PHP, configuring Xdebug, enabling required extensions, ...
... wait some more
6. Laravel is installed
The Laravel is installed and configured at this point with all the requisities. You don't need to configure PHP project or install Laravel intellisense composer package ( laravel-ide-helper it helps the Intellisense engine to provide better code completion for Laravel) this is done transparently.
To verify if it's really installed, just press
Adding Laravel plugins
Once Laravel is installed, you may want to install one of many plugins. There are plugins that will provide you with great looking admin section, role based security, ecommerce features, etc. There is really a lot to choose from.
You can install any of those plugins directly within Visual Studio. Right click on Dependencies node in the Solution Explorer and select Install new composer package...
Let's search for one that would take care of role based security. Type laravel permission
and click Install Package. You can close this dialog now, it will install on the background.
You will know it's installed from the status bar or when Composer Output pane shows it's completed with exit code 0.
Conclusion
We've tried to make this experience as straight forward as possible. The Laravel is first complex framework template we have added to the new project wizard, but we are definitely going to add more of them. Please let us know how it worked for you or what other framework we should add next.