developer in Arkansas (USA), was using an early version of CodeIgniter when the idea for Laravel came to him. “I couldn't add all the features I wanted to”, he says, “without mangling the internal code of the framework”. He wanted something leaner, simpler, and more flexible. Taylor Otwell
with Taylor's .NET background, spawned the framework that would become Laravel. He used the ideas of the .NET infrastructure which Microso had built and spent hundreds of millions of dollars of research on. With Laravel, Taylor sought to create a framework that would be known for its simplicity. He added to that simplicity by including an expressive syntax, clear structure, and incredibly thorough documentation. With that, Laravel was born.
a simple routing layer and a really simple controller-type interface (MVC) v1 and v2 were released in June 2011 and September 2011 respectively, just months apart In February 2012, Laravel 3 was released just over a year later and this is when Laravel's user base and popularity really began to grow.
Laravel 4 was released as a complete rewrite of the framework and incorporated a package manager called . Composer is an application-level package manager for PHP that allowed people to collaborate instead of compete. Before Composer, there was no way to take two separate packages and use different pieces of those packages together to create a single solution. Laravel is built on top of several packages most notably . Composer Symfony
5.3 with 5.4 currently in development Support for PHP 7 has recently been added to Laravel 4.2.20 and for the first version ever, long term support has been guaranteed for 5.1
split into classes where each class has specific attributes and behaviours. This leads to code that is more maintainable, more predictable and simpler to test.
required for processing requests namespace App\Http\Controllers\Admin; class TasksController extends Controller { public function view($id) { return "This is task " . $id; } }
Controller { public function view($id) { // Finds the task with 'id' = $id in the tasks table $task = Task::find($id); // Returns a view with the task data return View::make('tasks.view')>with(compact('task')); } }
the database A Task model would be tied to the tasks table in MySQL namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; class Task extends Model { use SoftDeletes; protected $fillable = ['title', 'done',]; protected $dates = ['deleted_at']; }
a high priority Task::where('priority', '=', 'high')>get(); Task::wherePriority('high')>get(); // *Magic*! // Retrieves all the tasks in the database Task::all(); // Retrieves a paginated view for tasks, 20 tasks per page Task::paginate(20); // Inserts a new task into the database Task::create(['description' => 'Buy milk']); // (Soft) deletes the task with an id of 5 Task::find(5)>delete(); // Permanently deletes all soft deleted tasks Task::onlyTrashed()>forceDelete();
templating engine provided with Laravel // This view uses the master layout @extends('layouts.master') @section('content') <p>This is my body content.</p> @stop @section('sidebar') <p>This is appended to the master sidebar.</p> @stop
command-line interface included with Laravel It provides a number of helpful commands that can assist you while you build your application $ php artisan list $ php artisan help migrate
Laravel 5 implements the autoloading standard which means all your classes are namespaced The default namespace for your web application is app You can change this using php artisan app:name <your‐app‐name> assets, views, and lang now live in a resources folder config, storage, database, and tests directories have been moved to the root of the project bootstrap, public, and vendor retain their place PSR-4
Instead of all the complex nested configuration directories, you have a .env file at the root of your project to take care of the application environment and all the environment variables. It is useful to create a .env.example file to provide a template for other team members to follow (dotEnv)
Middleware can be used to add extra layers to your HTTP routes. If you want code to execute before every route or before specific routes in your application, then such a piece of code is a good fit for a middleware class. For example, let's say you want to block out a certain range of IPs from your application to make your application unavailable in that region. In such a case, you will need to check the client IP before every request and allow/disallow them entry to your application. $ php artisan make:middleware "RegionMiddleware"
Until version 4.2, you had to request the Inversion of Control (IoC) container to provide a class instance or create it in your controller's constructor to make it accessible under the class scope. Now, you can declare the type hinted class instance in the controller method's signature and the IoC container will take care of it, even if there are multiple parameters in your controller function's signature.
App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Http\Requests\Admin\TaskUpdateRequest; use App\Models\Task; class TaskController extends Controller { public function store(TaskUpdateRequest $request) { $task = Task::create($request>except('_token')); return redirect(route('admin.task.index'))>with('success', trans('general.created', ['what' => 'Task'])); } } /**/ class TaskUpdateRequest extends FormRequest { public function rules() { return ['title' => 'required|min:3|unique:tasks,title',]; } }
are actually interface classes in disguise. Interfaces are a tried and tested method for removing class dependency and developing loosely coupled so ware components. . Most of the major core components make use of these contracts to keep the framework loosely coupled. Laravel buys into the same philosophy ⇲
is part of almost all the web applications you develop, and a lot of time is spent writing the authentication boilerplate. This is not the case any more with Laravel 5. The database migrations, models, controllers, and views just need to be configured to make it all work. Laravel 5 has a Registrar service, which is a crucial part of this out of the box, ready to use authentication system.
to compiling and concatenating your assets. If you've ever been intimidated by learning Gulp or Grunt, fear no more. Elixir makes it a cinch to get started using Gulp to compile Sass and other assets. It can even be configured to run your tests Laravel Elixir (Assumes sass is located at resources/assets/sass, etc.)
assets $ gulp // Run all tasks and minify all CSS and JavaScript $ gulp production // Watch your assets for any changes rebuild when required $ gulp watch
speed up development at UofA Improved version of Laravel 4.1 with backported enhancements from 4.2 This was due to the version of PHP (5.3.8) we previously had to use Has code specific for the way we have to work with web accounts Configured to use public_html rather than public LDAP integration complete with configuration for abdn.ac.uk Enhanced String and Array helpers UofA logos etc. Currently in the process of updating for Laravel 5.3
SERVICES Provision and deploy unlimited PHP applications on DigitalOcean, Linode, and AWS A package that provides scaffolding for subscription billing, invoices, etc. A deployment service focused on the deployment side of applications and includes things like zero downtime deploys, health checks, cron job monitoring, and more Forge Spark Envoyer
INTO LARAVEL 5 Event broadcasting, evolved. Bring the power of WebSockets to your application without the complexity. API authentication without the headache. Passport is an OAuth2 server that's ready in minutes. Driver based full-text search for Eloquent, complete with pagination and automatic indexing. Laravel Echo Laravel Passport Laravel Scout
DEVELOPMENT TOOLS Powered by Vagrant, Homestead gets your entire team on the same page with the latest PHP, MySQL, Postgres, Redis, and more. Cachet is the best way to inform customers of downtime. This is your status page. If all you need is an API and lightning fast speed, try Lumen. It's Laravel smaller-light. Need a CMS that runs on Laravel and is built for developers and clients? Look no further. Homestead Cachet Lumen Statamic