comment 0

How to Setup Laravel 4

“Goodbye Codeigniter… Hello Laravel” , maybe some of you ever heard that sentence before. In the first decade of Codeigniter , I was very interest with this PHP Framework. with their simplicity , great documentation and active forum it helps me to develop some app with this PHP Framework. But after work at Gameloft and just focus on develop game for Android devices I never touch Codeigniter again. And last week I hear the brand new PHP Framework that more powerfull than Codeigniter. It called Laravel. So for first touch I will share how to setup Laravel in Windows OS. In this tutorial I’m using composer and github to setup the Laravel.

1. First , we will clone the Laravel from github. here is the link of Laravel’s github https://github.com/laravel/laravel.git

run this command

git clone https://github.com/laravel/laravel.git

clone from github

2. with composer you can install the Laravel with this command

composer install

and wait for some minutes, composer will download and install the Laravel beside on composer.json

install laravel with composer

3. After complete the installation you can run Laravel to your local server with this command

php -S localhost:6969 -t public

so, we will run laravel in localhost with port 6969 and the target is public’s folder

run laravel on specific port

And the result will show in your browser like this


Sponsored links



laravel run on browser

 

Last , I will show how to using Laravel , just a little because I’m still learn too

Well , open the Laraval with Sublime. We want to add some route here. So, Edit routes.php and add this code

Route::get('{name}', function($name)
{
return View::make('callme')
->with('name', $name);
});

sublime edit routes

and then create a new file in views with name callme.blade.php ( in this case Laravel using blade template engine ).
add this code

<!doctype html>
    Laravel PHP Framework
 
 
 
<style>
        @import url(//fonts.googleapis.com/css?family=Lato:300,400,700);
 
        body {
            margin:0;
            font-family:'Lato', sans-serif;
            text-align:center;
            color: #999;
        }
 
        .welcome {
           width: 300px;
           height: 300px;
           position: absolute;
           left: 50%;
           top: 50%; 
           margin-left: -150px;
           margin-top: -150px;
        }
 
        a, a:visited {
            color:#FF5949;
            text-decoration:none;
        }
 
        a:hover {
            text-decoration:underline;
        }
 
        ul li {
            display:inline;
            margin:0 1.2em;
        }
 
        p {
            margin:2em 0;
            color:#555;
        }
    </style>

 

You have arrived {{ $name }}

 

 

then add string after you laravel’s url , example : localhost:6969/remix

Leave a Reply

Your email address will not be published. Required fields are marked *