Laravel Htdocs

Posted on  by admin

It is helpful for the new Laravel users to know the way of converting any static HTML template into a Laravel project and convert it into a dynamic web project. I have shown in my previous tutorials that how to convert any html template into angular project and codeigniter project. But the process of converting html template into Laravel project is different from other MVC framework based project. In this tutorial, I will show you how to convert a free responsive HTML template into a Laravel static project first and after that I will convert it into a dynamic project based on a MySQL database.

Steps:

Laravel Vapor is a serverless deployment platform for Laravel, powered by AWS. Launch your Laravel infrastructure on Vapor and fall in love with the scalable simplicity of serverless.

  1. So please help me to create my Laravel project at opt/lampp/htdocs folder.I will be glad and thankful if you give me some instructions to create a Laravel project at htdocs folder step by step because I am newbie in Linux OS.
  2. Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
  3. How can I start a laravel project outside of “htdocs” folder in xampp? Ask Question Asked 6 years, 7 months ago. Active 5 years, 7 months ago. Viewed 3k times 0. Is it a way to start a Laravel project in another folder? For example: instead of C:/xampp/htdocs.

1. You can download any free template from any site. I have download a free responsive HTML template from the following link.

https://demo.themewagon.com/preview/free-bootstrap-4-html5-real-estate-agency-website-template-stayhome

2. Download a fresh copy of Laravel 7 project named laravelproject and store it into htdocs folder. I have already shown this steps in my previous laravel tutorial.

3. Copy only the files from your template folder into the views folder of laravel project folder.

4. Rename all files with .html extension by .blade.php extension.

5. Copy all folders of the template into the public folder of laravel projects.

6. Open index.blade.php file in any editor and add the following line before each local (css and js) file links to set the base URL of laravel project.

7. If you are using any local image file then change the location same way.

8. Open web.php file under route folder and change the view file name from welcome to index.

10. Run the project for the first it. It will show the static content of the template from laravel project.

http://localhost/laravelProject/public

11. Modify .env file to set the proper MySQL database. I have used a database named laravel here.

12. Run the following command to create a migration file for creating the table named properties in the database laravel.

13. Open the migration file modify the file with the following content.

14. Run the following command to migrate database.

15. Add some records to the table named properties.

16. Run the following command to create a controller named PropertyController.

17. Run the following command to create Property model.

18. Modify the PropertyController with the following code.

19. Open index.blade.php file and go to the property section. Replace the content of the div that contains carousel-properties with the following content.

20. Replace the web.php file with the following code.

21. Now, run the project and check the property section. The data of properties table will be shown there. To get the image properly rename the property image name with the id of the property record.

In the next part of this tutorial, I will show you how you can make other pages of this template dynamic using Laravel.

You can check the following video tutorial to show the steps.

Click here for the next part of this tutorial.

In this article we will give you a step-by-step guide on how to install Laravel with XAMPP on Windows Using Composer. Through Composer it’s simple and easy to install Laravel with XAMPP.

# Server Requirements

Since we want to work with the latest version of Laravel 5.6, make sure your server meets the following requirements:

  • PHP >= 7.1.3
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension

For more information, you can check the Server Requirements from Laravel official site.

# Install XAMPP

First thing you need to do is download the latest version of XAMPP that supports PHP 7.3.1 and Install it on Windows. For more details, see our step by step guide on How To Download And Install XAMPP On Windows.

# Composer

Once you have downloaded and installed XAMPP on Windows, then you need to do is Download Composer for Windows and Install it. For more details, see our step by step guide on How to Install Composer On Windows With XAMPP.

Laravel utilizes Composer to manage its dependencies. It must installed before setting up Laravel.

Once you successfully installed the Composer, open the command prompt. To open it, press Win + R keys on the keyboard, type in cmd and press the OKbutton

Then type composer and press enter in the command prompt and you will get following response like in the below image.

# Install Laravel Framework

To install Laravel, First of all, you have to go C:/xampp/htdocs directory, to navigate it type following command in your command prompt:

Now we are ready to install Laravel, run the following command to install latest Laravel version:

After running this command it should start downloading dependencies that are required to create the Laravel project.

This installation may take a few minutes after executing the above command, so wait until you get success message like in the below image.

After executing this command, it create a folder ‘laravelprojectunder C:/xampp/htdocs directory with all it’s dependency.

When it completed, it will create following directory schema:

Laravel Htdocs Xampp

# XAMPP Virtual Host

We need to configure a Virtual Host in XAMPP for a Laravel project and in this example we want to configure the domain localhost.laravelproject.com for our project. To do so, edit httpd-vhosts.conf file which is located within C:xamppapacheconfextrahttpd-vhosts.conf

Add following code snippet at the end of your file:

After this, apache server is listening to localhost.laravelproject.com connections, but we have to configure our hosts file that allows to redirect localhost.laravelproject.com to the localhost , to do so, edit the hosts file which is located within C:WindowsSystem32driversetc

Add following code snippet at the end of your file:

Download

Now everything is ready, restart the Apache server using the XAMPP control panel and type this URL http://localhost.laravelproject.com in your browser and press enter.

Final Words

Laravel Docs Dirty

That’s it! I hope this article helped you learn to how to install Laravel with XAMPP Using Composer.

Please feel free to comment below, your suggestion and problems if you face – we are here to solve your problems.

Laravel Docs Validation

Related posts: