Laravel – Latest PHP Framework for Web Artisans

Back to Blog
Laravel Latest PHP Framework for Web Artisans

Laravel – Latest PHP Framework for Web Artisans

As we know PHP launches the frameworks after some interval of timing in regular interval of time. This time we will discuss about the customized MVC framework called as “Laravel”. We will discuss about the some basic part of the laravel that are needed to start the coding. It gives you the more customized way of development for the web application. Laravel is used mostly for the dependency management. Most sites have a common set of functionality (like handling sessions, data validation, etc) and a framework is something that prevents you from re-writing this each time you create a website. It gives the more customized way to create the database, table or to use the inbuilt libraries and functionality. Let’s talk about what the things needed to use it and how we can use it.

Installation and Basic Configuration

Installation : First download the “Laravel” installer through the composer. composer global require “laravel/installer=~1.1” -> You have to run this command in the cmd. But this command you have to run if only the composer is installed in your sysyem otherwise first install the composer by following below commands. Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.

Installing Composer: Open the “Cmd terminal” in your system and run the command

curl -sS https://getcomposer.org/installer | php

if curl installed in your system otherwise run and if curl is not installed in your system then run

php -r "readfile('https://getcomposer.org/installer');" | php

then continue with the laravel installation with the composer which command I written above. Once the laravel is installed you you have to set the certain permissions to use its functionality in that. You need to grant the web server write permissions to the app/storagedirectories. See the installation documentation for more details on configuration on laravel home website. We have installed laravel to use it using the Xampp server.

Now we will discuss about to use the laravel latest php framework functionality in the web application:

1. Routing : To get started, lets create our first route, this file is under the app/routes.php. add the following route to the bottom of the file.

Route::get('users', function()
{
return 'Users!';
});

Now, if you hit the /users in your browser then you will see the message like Great! You’ve just created your first route.

2. View : Next we will create the view to display the user data in the web browser. View is present in the folder app/views and contains the HTML of your application.

<html>
<body>
<h1>Laravel Quickstart</h1>
@yield('content')
</body>
</html>

3. Displaying data: Now by following above to instructions we made the users data and view part now we will display the part to the user.

@extends('layout')
@section('content')
@foreach($users as $user)
<p>{{ $user->name }}</p>
@endforeach
@stop

By looking to this you wondering that where is echo statement in the code but in laravel you can display the data by using double curly braces. Now hit the /users in the browser and you will be able to names of your users displayed in the response.

Advantages or Pros of Laravel PHP Framework :

1. Laravel support PHP 5.3 or latest version and fully oject oriendted based.
2. It has inbuilt ORM system called Eloquent
3. Laravel works on DRY (Don’t-Repeat-Yourself) method, so one written functionality can be access any place and where in system.
4. Laravel follow parallel testing mechanism rules ensure the code works properly.
5. Laravel has great support IRC channel is always quick response to get any development help.
6. Laravel support simple yet powerful Blade Templating Engine

Disadvantages or Cons of Laravel PHP Framework :

1. Laravel is new php framework which mean some instability with the code.
2. Because its new framework so code or api reference, community forum, framework documentation and finding answers are little limited than other framework like Yii, Zend, Codeignitor, Cakephp etc.
3. It has blade template so its little hard to understand who are newbee in framework.
4. Routing System is little odd and hard to understand sometimes.
5. Its new framework so little worry about next releases, updates and framework support and its community growth.

Share this post

Leave a Reply

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

Back to Blog