Laravel PHP App

Laravel

by Laravel

A PHP Framework for Web Artisans
Helps with: PHP
Similar to: ThinkPHP App Yii 2.0 App Flow App Silex App More...
Source Type: Open
License Types:
MIT
Supported OS:
Languages: Other

What is it all about?

Laravel is a web application framework with expressive, elegant syntax that eases common tasks frequently used in web projects such as authentication, routing, sessions, queueing, and caching.

Video & Images

Images

Laravel App Screen 0

Key Features

Simple & fast routing engine: All Laravel routes are defined in your route files, which are located in the routes directory. These files are automatically loaded by the framework. Powerful dependency injection container: The Laravel service container is a powerful tool for managing class dependencies and performing dependency injection. Multiple back-ends for session and cache storage: Laravel ships with a variety of session backends that are accessed through an expressive, unified API which is also used for various caching backends. Expressive & intuitive database ORM: The Eloquent ORM included with Laravel provides a beautiful, simple ActiveRecord implementation for working with your database. Database agnostic schema migrations: Migrations are typically paired with Laravel's schema builder to easily build your application's database schema. Robust background job processing: Laravel queues provide a unified API across a variety of different queue backends that allow you to defer the processing of a time consuming task, drastically speeding up web requests to your application. Real-time event broadcasting: Laravel makes it easy to "broadcast" your events over a WebSocket connection. Broadcasting your Laravel events allows you to share the same event names between your server-side code and your client-side JavaScript application.


Resources

Resource Type

Link

Wikipedia https://en.wikipedia.org/wiki/Laravel

Pricing

Yearly
Monthly
Lifetime
Free
Freemium
Trial With Card
Trial No Card
By Quote

Description

Free - See site

Product Analysis

PHP

PHP frameworks and libraries

Laravel Review

Laravel Review

By Alvie Amar | 5/25/2016 | Product Analysis |Beginners

Laravel is a free web application framework, created by Taylor Otwell. It was written in PHP and like many other web frameworks follows the model–view–controller (MVC) architectural pattern. It was created with the intention of providing a more advanced alternative to CodeIgniter Framework. It has built-in support for user authentication and authorization that CodeIgniter doesn’t have.

 

In addition, Laravel is easy to learn because it has a large community with a large amount of simple yet well explained documentation that you can find on their website: laravel.com. Aside from their cool documentation you can also watch the best video tutorials in laracasts.com by Jeffrey Way.

 

An overview of some of the key features of Laravel are

  • Eloquent ORM (object-relational mapping)
  • Query builder
  • Reverse routing
  • Restful controllers
  • Blade templating engine
  • Migrations
  • Database seeding
  • Unit testing
  • Uses Composer as a dependency manager

 

If you want to install any external packages you can do this with composer. It also uses Artisan CLI, a tool in which you can run common commands like creating a controller, seeding databases and running unit tests. Once you dig deeper into learning Laravel you can discover and learn how to use other features not mentioned above. And don’t worry, the Laravel community is very friendly and helpful.

 

What is Laravel good for?

There are many PHP frameworks, so why choose Laravel? What’s the point of using Laravel for web applications?

 

Laravel is helpful in building wonderful applications using simple and expressive syntax thus making the development process run more smoothly while creating easily maintainable code. It will allow developers to develop modules and applications using the core library functions allowing them to develop anything they want from scratch. Laravel’s excellent foundation, maintainability, and powerful features makes it superior over other frameworks.

 

Here are some advantages of using Laravel:

 

  • Laravel has an active and growing community that can provide quick support and answers.
  • Laravel’s syntax is straightforward and easily readable.
  • Laravel has a quick and functional core that can be extended.
  • Laravel has clean and simple routing.
  • Laravel makes working with database relation easier by using Eloquent ORM and it uses Migrations.
  • Laravel is easy to integrate with other third party libraries using composer.
  • Code is kept organized, and using a framework like Laravel helps enforce the use of best practices.
  • Most importantly it has an innovative founder.




Laravel Examples and Code Snippets

 

Here are some examples of how wonderful Laravel is. Let's start by assuming that we want to create a simple application using Laravel. We'll assume we've already installed and setup Laravel. First we need to design the database. Laravel has a feature called Migrations. Migrations are like version control of the database. They are simply PHP source files that are used to update the database. Once they are executed they change the database schema. We can run migrations in the Artisan CLI.

Migrations

First thing we need to do is to install a migration table. This command will create the table in the database:

$ php artisan migrate:install

 

Let us create the migration file. Let's try to create a new table named “users”. Run the artisan migrate:make command:

 

$ php artisan make:migration create_users_table

 

The command would generate a migration class skeleton that would look like this

 

<?php

use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

        /**
        * Run the migrations.
        */
        public function up()
        {
                //
        }

        /**
        * Reverse the migrations.
        */
        public function down()
        {
                //
        }

}

 

You could manually add additional fields that would look something like this,

<?php

use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration {

        public function up()
        {
                Schema::create('users', function($table)
                {
                        $table->increments('id');
                        $table->string('name');
                });
        }

        public function down()
        {
                Schema::drop('users');
        }

}

Model

 

We've already stated that Laravel follows an MVC pattern, so after designing the database, we would now proceed in creating the model, controller and view. First we will create the model. The model is the component responsible for communicating with the database. Each table has a corresponding Model which is used to interact with that table.

 

To create a model we could run the make:model command in the artisan CLI.

$ php artisan make:model User

The Model would look something like this.

<?php

class User extends Eloquent {    
    protected $table = 'users';
}

 

Controller

 

Next let us create the controller which contains the functionalities and is where the business logic is located.

 

To create a controller we could run the make:controller command in the artisan CLI.

 

$ php artisan make:controller User

 

Here is an example of a basic controller class:

class UserController extends BaseController {
    /**
     * Show the profile for the given user.
     */
    public function showProfile($id)
    {
        $user = User::find($id);
        return View::make('user.profile', array('user' => $user));
    }
}

View

 

Finally let us create the view, it contains the HTML and provides a convenient way of separating the controller and domain logic from the presentation logic. Laravel also provide the blade template engine that could also be used in the view.  Blade does not restrict from using plain PHP code in the views. It has a file extension of .blade.php

Here is an example of a basic view

<html>
    <head>
        <title>App Name - @yield('title')</title>
    </head>
    <body>
        @section('sidebar')
            This is the master sidebar.
        @show

        <div class="container">
            @yield('content')
        </div>
    </body>
</html>

 

 As you can see the view contains HTML mark-up, however it also has @section and @yield directives that are provided by the blade template. The @section directive, defines a section of content. The @yield directive displays the content of the given question.

 

These are just some of the basics and examples with code snippets of Laravel. As you dig deeper to Laravel you will discover many other great things Laravel could do.

 

Conclusion

Though Laravel is not as mature as some of the other popular PHP frameworks, it has a growing community which is amazing because it implies that many developers are interested in it. Many are talking about it, many have learned it already and many want to learn it. This also helps demonstrate that the learning curve is not too steep. So if you are a PHP developer or a web developer who has yet to try working with Laravel, why not give a shot? There are still many great things to discover.

 

By Alvie Amar | 5/25/2016 | Product Analysis

{{CommentsModel.TotalCount}} Comments

Your Comment

{{CommentsModel.Message}}

Top DiscoverSDK Experts

User photo
3355
Ashton Torrence
Web and Windows developer
GUI | Web and 11 more
View Profile
User photo
1490
Ronan McCarthy
Cross-Platform & Web developer.
Web | Mobile and 6 more
View Profile
User photo
1230
Gary Green
Expert programmer, Ask what you want
Web | JavaScript and 3 more
View Profile
User photo
1130
Harry Gold
Experienced Web developer.
Web | JavaScript and 3 more
View Profile
Show All

Interested in becoming a DiscoverSDK Expert? Learn more

X

Compare Products

Select up to three two products to compare by clicking on the compare icon () of each product.

{{compareToolModel.Error}}

Now comparing:

{{product.ProductName | createSubstring:25}} X
Compare Now