Laravel TutorialChange default routing behaviour in Laravel 5.2.31 +CustomException class in LaravelDeploy Laravel 5 App on Shared Hosting on Linux ServerLaravel ArtisanLaravel AuthenticationLaravel AuthorizationLaravel Blade TemplatesLaravel CashierLaravel CollectionsLaravel Common Issues & Quick FixesLaravel ConstantsLaravel ControllersLaravel Cron basicsLaravel Cross Domain RequestLaravel Custom Helper functionLaravel DatabaseLaravel Database MigrationsLaravel Database SeedingLaravel Directory StructureLaravel DockerLaravel EloquentLaravel Eloquent : RelationshipLaravel Eloquent: Accessors & MutatorsLaravel Eloquent: ModelLaravel Error HandlingLaravel Events and ListenersLaravel Filesystem / Cloud StorageLaravel Form Request(s)Laravel Getting started with laravel-5.3Laravel HelpersLaravel HTML and Form BuilderLaravel InstallationLaravel Installation GuideLaravel Introduction to laravel-5.2Laravel Introduction to laravel-5.3Laravel lumen frameworkLaravel Macros in Eloquent RelationshipLaravel MailLaravel MiddlewareLaravel ObserverLaravel PackagesLaravel PaginationLaravel Permissions for storageLaravel PoliciesLaravel QueuesLaravel RequestsLaravel Route Model BindingLaravel RoutingLaravel SeedingLaravel ServicesLaravel SocialiteLaravel Task SchedulingLaravel TestingLaravel Token Mismatch Error in AJAXLaravel use fields aliases in EloquentLaravel Useful linksLaravel ValetLaravel ValidationMultiple DB Connections in LaravelNaming Files when uploading with Laravel on WindowsRemove public from URL in laravelSparkpost integration with Laravel 5.4

Laravel Installation Guide

From WikiOD

Remarks[edit | edit source]

This section provides an overview of what laravel-5.4 is, and why a developer might want to use it.

It should also mention any large subjects within laravel-5.4, and link out to the related topics. Since the Documentation for laravel-5.4 is new, you may need to create initial versions of those related topics.

Installation[edit | edit source]

Detailed instructions on getting laravel set up or installed.

composer is required for installing laravel easily.

There are 3 methods of installing laravel in your system:

Via Laravel Installer

Download the Laravel installer using composer

composer global require "laravel/installer"

Before using composer we need to add ~/.composer/vendor/bin to PATH. After installation has finished we can use laravel new command to create a new project in Laravel.


laravel new {folder name}

This command creates a new directory named as site and a fresh Laravel installation with all other dependencies are installed in the directory.

Via Composer Create-Project

You can use the command in the terminal to create a new Laravel app:

composer create-project laravel/laravel {folder name}

Via Download

Download Laravel and unzip it.

  • composer install

Copy .env.example to .env via teminal or manually.

cp .env.example .env
  • Open .env file and set your database, email, pusher, etc. (if needed)
  • php artisan migrate (if database is setup)
  • php artisan key:generate
  • php artisan serve
  • Go to localhost:8000 to view the site

Laravel docs

Hello World Example (Basic)[edit | edit source]

Accessing pages and outputting data is fairly easy in Laravel. All of the page routes are located in app/routes.php. There are usually a few examples to get you started, but we're going to create a new route. Open your app/routes.php, and paste in the following code:

Route::get('helloworld', function () {
    return '<h1>Hello World</h1>';

This tells Laravel that when someone accesses http://localhost/helloworld in a browser, it should run the function and return the string provided.

Hello World Example With Views and Controller[edit | edit source]

Assuming we have a working laravel application running in, say, "",we want our application to show a "Hello World" message when we hit the URL . It involves the creation of two files (the view and the controller) and the modification of an existing file, the router.

The view[edit | edit source]

First off , we open a new blade view file named helloview.blade.php with the "Hello World" string. Create it in the directory app/resources/views

<h1>Hello, World</h1>

The controller[edit | edit source]

Now we create a controller that will manage the display of that view with the "Hello World" string. We'll use artisan in the command line.

$> cd your_laravel_project_root_directory
$> php artisan make:controller HelloController

That will just create a file (app/Http/Controllers/HelloController.php) containing the class that is our new controller HelloController.

Edit that new file and write a new method hello that will display the view we created before.

public function hello()
    return view('helloview'); 

That 'helloview' argument in the view function is just the name of the view file without the trailing ".blade.php". Laravel will know how to find it.

Now when we call the method hello of the controller HelloController it will display the message. But how do we link that to a call to ? With the final step, the routing.

The router[edit | edit source]

Open the existing file app/routes/web.php (in older laravel versions app/Http/routes.php) and add this line:

Route::get('/helloworld', 'HelloController@hello');

which is a very self-explaining command saying to our laravel app: "When someone uses the GET verb to access '/helloworld' in this laravel app, return the results of calling the function hello in the HelloController controller.