Home » News

Category Archives: News

Laravel 5.2 Installation

Server Requirements

The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine, so it’s highly recommended that you use Homestead as your local Laravel development environment.

However, if you are not using Homestead, you will need to make sure your server meets the following requirements:

PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension

Installing Laravel

Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.
Via Laravel Installer

First, download the Laravel installer using Composer:

composer global require “laravel/installer”

Make sure to place the ~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your PATH so the laravel executable can be located by your system.

Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel’s dependencies already installed. This method of installation is much faster than installing via Composer:

laravel new blog

Via Composer Create-Project

Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:

composer create-project –prefer-dist laravel/laravel blog

Configuration

All of the configuration files for the Laravel framework are stored in the config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
Directory Permissions

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
Application Key

The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command. Typically, this string should be 32 characters long. The key can be set in the .env environment file. If you have not renamed the .env.example file to .env, you should do that now. If the application key is not set, your user sessions and other encrypted data will not be secure!
Additional Configuration

Laravel needs almost no other configuration out of the box. You are free to get started developing! However, you may wish to review the config/app.php file and its documentation. It contains several options such as timezone and locale that you may wish to change according to your application.

You may also want to configure a few additional components of Laravel, such as:

Cache
Database
Session

Once Laravel is installed, you should also configure your local environment.
Source: https://laravel.com/docs/5.2

What’s New in Laravel 5.2

Laravel 5.2 development is underway and so far a few nice additions have been announced. Let’s take a look at everything we know is coming to the release.

Auth Scaffolding

Making a come back is the auth scaffolding which will automatically create a base set of view files for authentication, registration, and password resets. This will be ran via:

php artisan make:auth

Implicit model binding

Implicit model binding is a new feature that automatically binds a model to a route. Here is an example in code:

Route::get('/api/posts/{post}', function(Post $post) {
    return $post;
});

What this does is behind the scenes call Post::findOrFail($post) and injects it into the $post variable. For the seasoned Laravel developers, this is similar to the existing route model binding but now removes the step of having to bind it manually.

Appending output from scheduled tasks

The Laravel Scheduler will now be able to append output from the task to a file.

$schedule->command('emails:send')
    ->hourly()
    ->appendOutputTo($filePath);

Previously, Laravel included a sendOutputTo option which would write the current results but not append.

Laravel 5.2 Form Array Validation

This is a feature I’m excited about. In fact, I wrote a whole tutorial on one way of making it work and it has been a popular post.

Pretend you have a form with an array of input fields like this:

<p>
<input type="text" name="person[1][id]">
<input type="text" name="person[1][name]">
</p>
<p>
<input type="text" name="person[2][id]">
<input type="text" name="person[2][name]">
</p>

In Laravel 5.1 to add validation rules it required looping through and adding the rules individually. Instead of having to do all that it’s been “Laravelized” into this:

$v = Validator::make($request->all(), [
  'person.*.id' => 'exists:users.id',
  'person.*.name' => 'required:string',
]);

Collections Wildcards

When using a collection and wanting to pull out data, you can now pass a * as a wildcard:

$posts->pluck(‘posts.*.title’);

This will return all title’s for all posts.

Database Session Driver

The database session driver now includes user_id and ip_address so you can easily clear all sessions for a given user.

MySQL JSON Column Types

MySQL 5.7.8 added support for a native JSON data type. Laravel 5.2 now adds support for this column type.

 

Source: https://laravel-news.com

Laravel 5.1 Installation

Server Requirements

The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the Laravel Homestead virtual machine:

PHP >= 5.5.9
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension

Installing Laravel

Laravel utilizes Composer to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.
Via Laravel Installer

First, download the Laravel installer using Composer:

composer global require “laravel/installer”

Make sure to place the ~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your PATH so the laravel executable can be located by your system.

Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog will create a directory named blog containing a fresh Laravel installation with all of Laravel’s dependencies already installed. This method of installation is much faster than installing via Composer:

laravel new blog

Via Composer Create-Project

Alternatively, you may also install Laravel by issuing the Composer create-project command in your terminal:

composer create-project –prefer-dist laravel/laravel blog

Configuration

All of the configuration files for the Laravel framework are stored in the config directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
Directory Permissions

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
Application Key

The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command. Typically, this string should be 32 characters long. The key can be set in the .env environment file. If you have not renamed the .env.example file to .env, you should do that now. If the application key is not set, your user sessions and other encrypted data will not be secure!
Additional Configuration

Laravel needs almost no other configuration out of the box. You are free to get started developing! However, you may wish to review the config/app.php file and its documentation. It contains several options such as timezone and locale that you may wish to change according to your application.

You may also want to configure a few additional components of Laravel, such as:

Cache
Database
Session

Once Laravel is installed, you should also configure your local environment.
Source: https://laravel.com/docs/5.1

Love beautiful code

The PHP Framework For Web Artisans

<?php


class Idea extends Eloquent {

	/**
	 * Dreaming of something more?
	 *
	 * @with  Laravel
	 */
	 public function create()
	 {
	 	// Have a fresh start...
	 }

}