Conor Conor - 1 year ago 145
PHP Question

Starting of laravel in windows

I have recently started using laravel

I have searched a lot and found many help how to start a project in laravel.

I am using windows 64bit and xampp

As per the guide from Larvel and Turtorialspoint I have figured out how to start using laravel.

Fisrt Install

then install
and then create a project

I have first installed composer using composer-install.exe which is available in laravel site.

I run that setup and installed it in

Then I run the code
composer create-project laravel/laravel laravel
on the location

I got the project installed successfully..... :)

enter image description here

Then i run it in local host by the following code
php artisan serve

It gave me an localhost link which lead me too:

enter image description here
It was according to the instructions from tutorialspoint.
But there Laravel was not like this.(not a matter)

And when i searched further i cant understand anything.

They have completely different files(some) and the codes are very different.

Please someone guide me how to do an "Hello World" Example in it.

And i found
missing! Please find it also.

enter image description here

Answer Source

I think this would be a good reference for you.

According to Laravel, you can define your routes inside web.php file under routes\web.php folder

Your views would be under resources\views folder

Create a controller using command line. php artisan make:controller Welcome

Edit your controller file and edit the generated code.


namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

class Welcome extends Controller

    public function index() {
      $data = array('name'=>'Conor');
      return view('hello',$data);

Create a view manually if not present inside resources\views\hello.php

<!DOCTYPE html>
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
        <meta charset="UTF-8">
        <title>Hello <?php echo $name; ?></title>
        <h3>Hello <?php echo $name;?></h3>

Edit App\routes\web.php and add the following code Route::get('/welcome', 'Welcome@index');

Now run php artisan serve

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download