Laravel For Beginners - Neuroon Networks

Breaking

Wednesday, September 5, 2018

Laravel For Beginners

What is Laravel???

Laravel is a web application framework with expressive, elegant syntax. The laravel development group believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.

Laravel aims to make the development process a pleasing one for the developer without sacrificing application functionality. Happy developers make the best code. To this end, we've attempted to combine the very best of what we have seen in other web frameworks, including frameworks implemented in other languages, such as Ruby on Rails, ASP.NET MVC, and Sinatra.
Laravel is accessible, yet powerful, providing powerful tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.

Let's get started

Installation

This demonstration is about how to install laravel in Ubuntu machine. For windows users, there will be another lesson on it. So basically you need to check some prerequisites before install laravel. They are,
  • PHP version >= 7.1.3
  • Apacher server
  • MySQL Database configuration
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
  • Ctype PHP Extension
  • JSON PHP Extension
Use following shell commands to configure those things.
  • Install PHP => sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
  • Install Apache => sudo apt install apache2
  • Install MySQL => sudo apt install mysql-server
These commands are for configure php extensions.
  • For php extensions use => sudo apt-get install php-<missing extension>
  • To check missing extension => php -m
By using above shell commands you can configure prerequisites to install laravel.

To install Laravel, we need composer which is a dependency manager for laravel. To install composer user following shell commands.

  • php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  • php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  • php composer-setup.php
  • php -r "unlink('composer-setup.php');"
Now use composer to install laravel in you local computer. Use the following shell command to do it     
  • composer global require "laravel/installer"

So now you are done to install Laravel. Just change you directory to /var/www/html and use following shell command to install laravel.( make sure that you html folder has enough privileges to run laravel).
  • Via Laravel Installer,
    • laravel new blog
  • Via Composer,
    • composer create-project --prefer-dist laravel/laravel blog "5.6.*"

Here you can change the required version when you are using composer to install laravel. So now you have successfully install laravel in LAMP server. Now let's see it is working. Use following shell command within the laravel project. In here I should change my directory to "blog" folder as it is my new laravel project.

php artisan serve

Now go to you browser and type,
  • localhost:8000  or
  • 127.0.0.1:8000
You will see a page like this.

So it's done for now and keep in touch with us for more lessons.

No comments:

Post a Comment