Laravel Htdocs

  • Add Laravel Folder Path to http-vhosts.conf: I have installed xampp in D: drive so my http-vhosts.conf file path is D: xampp apache conf extra httpd-vhosts.conf. Open http-vosts.conf file and paste below code at the bottom.
  • Once it’s done, you can create a fresh Laravel project with the laravel new command in the directory you’re in. In your terminal go to the root of your webserver (e.g.: cd C: xampp htdocs ) and run laravel new yourproject.

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.

The Laravel framework with evocative and expressive from querying helps the developer in creating scalable functions that can withstand the rigors of modern-day programming. The route grouping is a great way to keep the code neat as well as reduce programming time. 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. 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.

Steps:

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.

Htdocs

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.

Laravel htdocs xampp

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.

Laravel Docs Validation

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.

Laravel Htdocs Xampp

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.

  • Windows Installed System.

Laravel 5.7 requires PHP version 7.1.3 or more, and some other extensions. Since we are doing setup on XAMPP, it has all the required php extensions within it. Make sure to Install the XAMPP with version >=7.2.0

Install XAMPP

First of all we need to download and install XAMPP for Linux. Download it from the apache friends official website. Download the XAMPP version > 7.2.0 which contains PHP version 7.1.3

Follow the steps for XAMPP installation. For Windows, the default installation directory for XAMPP is C:xampp

Laravel Docs Offline

Once the XAMPP is installed you should be able to access its manager console.

If your XAMPP is correctly installed and apache web server if turned on in the xampp control panel, You should see this page when you access http://locahost in your browser.

Once you are done with XAMPP, it’s now time to setup Composer.

Composer is a dependency management or package management tool which is integrated with Laravel Framework. Check by running composer command in your terminal if your system has composer already installed in it.

If not you can install it by following this tutorial How to Install Composer on Windows

Laravel Docs

The default directory of XAMPP for installing or keeping PHP project is htdocs. Navigate to following directory in your terminal C:xampphtdocs and run following composer command to create a fresh Laravel 5.7 version

Laravel Htdocs

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

When it finishes it will create a Laravel 5.7 project with following data structure.

Now, it’s time to run the Laravel project that we have installed. There are couple of ways you can do this.

#1 Artisan Command

Artisan command are built into the Laravel library, and one of it’s command it to serve the project on server. Navigate to the directory in which you have created your new laravel project and run following command.

And then, open the following link in the browser: http://localhost:8000

#2 XAMPP Virtual Host.

If you are looking to assign a permanent domain to your project, you can do so by configuring the xampp virtual host.

We need to configure XAMPP Virtual Host to set the document root to correct directory of laravel project and to also assign a name to the project by which we will be accessing it in browser.

Navigate and open file C:xamppapacheconfextrahttpd-vhosts.conf and include following Virtual host entry in this file.

With this entry our apache is listening to laravel.local, but we also have to edit our hosts file to include an entry for the new domain.

Edit file C:WindowsSystem32driversetc and add following entry to that file.

Restart your apache and access laravel.local on your browser you should be able to see this screen.

Have Fun working with Laravel !

If you are looking for an updated tutorial that works with Laravel 5.8 and particularly gives details on setting up Laravel on Server checkout this tutorial -> Install Laravel.

Done with Laravel Setup, Go ahead and move to next step with the following tutorials.