每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;微博:https://weibo.com/openingsource;电报群 https://t.me/OpeningSourceOrg

2018年5月28日:开源日报第81期

今日推荐开源项目:《Web 开发人员技术路线图 Web Developer Roadmap – 2018》GitHub链接

推荐理由:该项目包含了一系列图表,展示了为了成为前端、后端、DevOps 开发人员,你可以走的路径和你可能用得到的技术。它并不是让你去学习那些很潮的流行玩意,而是给你一个大概的轮廓,在你困惑的时候指出一个方向告诉你可以去学什么。相信对于正在 Web 路上不懈奋斗的朋友们来说,这份图表会派上用场的。

2018年5月28日:开源日报第81期

今日推荐英文原文:《Getting started with Laravel》作者:

原文链接:https://opensourceforu.com/2018/05/getting-started-with-laravel/

推荐理由:介绍了 PHP 框架 Laravel,包括它的安装方法和最新特性,适合正在学习 PHP 的朋友们一读

Getting started with Laravel

PHP is regarded as one of the most popular and versatile scripting language. It is really easy to get hands on with PHP. Almost exclusively used in web development, it has gained far reaching recognition. PHP frameworks are popularly known as functional platform. It helps developers to make complex applications quickly and easily. There are numerous PHP frameworks which are there in the market, out of which Laravel is popular due its elegancy and stability.

What is Laravel?
Laravel is a framework created by Taylor Otwell. It is an advanced form of CodeIgniter framework. Laravel is an expressive framework viable for large scale work.

• It is following MVC (Model – View – Controller) architectural pattern.

Laravel is designed to facilitate the users, helping them to work in standardized, elegant and quick manner.

2018年5月28日:开源日报第81期Standardization:
Laravel has a strict Model-View-Controller (MVC) structure.  It uses object oriented programming concept and allows easy sharing of the project with the developers.  The style and methodology followed in Laravel Applications is almost similar which gives freedom to the developers to easily come in and work instantly with familiar mindset.

Elegance
Documentation of Laravel is neatly structured.  It can easily match various versions of Laravel. It is very flexible and one can do same things in a number of different ways. The whole framework provides simple characteristics to help developers write the code in organized and self-documenting manner.

Speed 
The speed of building an application is quite fast. Laravel works really well with various third party packages.  This indicates that full support for Facebook API, MailChimp API, Loggers, Profilers and other tools can be added easily within strike of few keystrokes.

The Composer
Composer is a dependency manager for PHP, which allows users to manage libraries in a meaningful manner. By dependency, it means the libraries that are required to make a page work. The composer will download all the libraries required in a particular project. Before starting with Laravel, one has to install composer in the system. You can look for the steps to install a composer here.

Installation of Laravel

You can install Laravel in the following three ways:

  • Laravel Installer
  • Via Composer Create Project
  • Download code from Github

We will be using composer to set up Laravel.

1. Open the command prompt.
2. Go to the path in your machine where you wish to install Laravel.
For instance, D:\projects

3. Run the command from the command window D:\projects path:

We are keeping the project name: laravel-demo. Once you run the above command it will like the following:

2018年5月28日:开源日报第81期Above command will create a new laravel setup on this path:

4. Database Connection

Once installation process will be completed successfully, open .env file from your root directory and setup database configurations in this file as per below mentioned screenshot.

2018年5月28日:开源日报第81期Now, database connection is successful.

5. Run new setup

Here we assume that you have installed PHP on your local server to run our new setup.
Now run the below command from the following:

see the screenshot below:

2018年5月28日:开源日报第81期Once you run the command in command prompt, it will show the message like Laravel development server started, as shown in the above screenshot.

Now you can run your new Laravel Application on Browser using the following:

http://127.0.0.1:8000

The default page of Laravel will be displayed after successful completion of the above steps.

2018年5月28日:开源日报第81期Laravel is successfully setup.

Key features of Laravel 5.6
The latest version of Laravel is 5.6, which is out now. Let us explore, what is new in this version

1. Single server Scheduling:
If you have a task scheduler running on multiple servers, a particular task will run on each server. With the help of onOneServer() method you can indicate that a task should run on any one of those servers.

You must use memcached or redis cache driver as the default application, so that you can take advantage of single server task scheduling.

2. Limit rate dynamically:
This function in Laravel 5.6 provides flexibility to its users and allows to easily rate limit on a per user basis.

In this example, the rate limit is an attribute of App\User model. It is used to determine the number of requests that are allowed in the given time limit.

3. Broadcast the Channel Classes
The channel classes can be used in routes/channels.php file in place of using closures.
make:channel command is introduced in Laravel 5.6. It can be used for generating a new channel class.

Also, you can register your channel in the routes/channels.php file like the following:

4. API Controller Generation 
You can now generate a resource controller for APIs, where unnecessary create and edit actions are avoided. This is applicable to resource controllers returning HTML.  Use –api flag to generate a resource controller.

5. Aliases for Blade Component
With Laravel 5.6, we can make alias for blade components in order to have more convenient access.

For instance, suppose a component is stored at resources/views/components/alert.blade.php. In order to make a shorter name, you can use the component() method to alias it.

Now you can easily render it with the aliases defined:

6. Argon Password Hashing
A new password hashing algorithm is supported by Laravel 5.6. One can even control which hashng driver to be used by default in the new configuration file

7. Method for UUID (Universal Unique Identifiers)
For generating Universal Unique Identifiers, two new methods are available in the Illuminate\Support\Str Class.

The orderedUuid()method will generate the first UUID. This will be time-stamped for efficient and simple indexing of database.

8. Bootstrap 4
Laravel 5.6 has covered Bootstrap 4 functionalities to provide better frontend development functions.

The upgrade from version 5.5 to 5.6 will hardly take 30 minutes. I hope you will now be able to easily install the latest version of Laravel.  If you have any new thing to say about Laravel, your views are welcomed in the comments below.


每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,欢迎关注开源日报。交流QQ群:202790710;微博:https://weibo.com/openingsource;电报群 https://t.me/OpeningSourceOrg