The first Laravel App

Laravel is a open source PHP web application framework. Its source code hosted on GitHub

According to Best PHP Frameworks for 2014, Laravel is listed as the most popular PHP framework, followed by Phalcon, Symfony2, CodeIgniter and others.

Setup Laravel Installer

Install composer

Install Laravel installer

place the ~/.composer/vendor/bin directory in your PATH by edit the file ~/.profile

Create Laravel App

Convert tabs to spaces


Edit the app/routes.php.

1. Closure routes


2. Routes that attached to controller classes

The codes are very easy to understand.


edit app/controllers/HomeController.php

Creating A View

edit app/views/hello.php

Pretty URLs on Nginx

You can find more info about “how to install laravel” from  I tried use the following commands to set pretty URLs on Nginx as it told form, but it does not work on my situation need to change “$query_string” to “args“.

Fix errors

1. /usr/bin/env: php: No such file or directory

2. The PHP cURL extension must be installed to use Guzzle.

Install php extension: curl

If you php is built from source codes you will find ext/mysqlnd in your php sources codes

if success you will see this:

edit /usr/local/php5/lib/php.ini

3. Fatal error: Class ‘ZipArchive’ not found

install php extension: zip

4. Mcrypt PHP extension required.

install php extension: mycrypt

5. configure: error: mcrypt.h not found. Please reinstall libmcrypt.

6. Error in exception handler.

Laravel hide the error behind the scenes, so you need find out the real problem.Go to app/config/app.php. Modify line to enable debug mode: ‘debug’ => true


Leave a Reply

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