Laravel 7 - Find The List Of New Features Here - indylogixnew
Get Quote
×

    Indylogix Website - IndyLogix Solutions

    Let's Discuss Business Together

    +
    Address
    406-408, Devnandan Mega Mall, Opp. Sanyas Ashram, Ashram Rd, Ellisbridge, Ahmedabad, Gujarat 380006

    Laravel has become a well-known name in the world of web application development at the present date. Bombarded with a collection of excellent features, this framework enables you to create outstanding high performing web applications. Due to the amazing features that the Laravel framework contributes to the development of web applications, a significant hike in the employment of Laravel development is observed in recent times. A large number of organizations are seen making use of this framework to create their next application and looking to laravel development company very frequently these days. 

    The latest release of Laravel is Laravel 7, officially released on March 3, 2020. The release has incorporated a number of amazing features and previous fixes to the Laravel framework. 

    The new features that are included in Laravel 7 can be seen as under :

    1. Improved Routing Speed

    Laravel 7 provides a 2x accelerated speed as compared to Laravel 6 by making use of route:cache. Route Model binding is yet another excellent feature incorporated in Laravel 7. This feature enables you to connect your model with your route.

    2. Artisan Command

    An innovative artisan command “php artisan test” has been included in Laravel 7. 

    laravel-banner

    3. A New Http Client

    It is primarily created for a call to API endpoints.

    POST Request

    <?php

    use Illuminate\Support\Facades\Http;

     $response = Http::post($url);

     $response = Http::post($url, [

    ‘site’ => ‘Laravel 7’,

    ]);

    GET Request

    $response = Http::get($url);

    $response = Http::get($url,[‘xyz’=>’pqr’]);

    With Header

    $response = Http::withHeaders([‘xyz’ => ‘pqr’])->

    post($url, [ 

    ‘baz’ => ‘qux’, 

    ]);

    Response

    $response[‘xyz’] 

    $response->body() 

    $response->json() 

    $response->status() 

    $response->ok()

    4. Zttp for Http Client

    Zttp is an uncomplicated Guzzle wrapper that is intended to give a remarkably convenient development experience for the most typical use cases. It is an innovative PHP package introduced by Adam Wathan that contributes a powerful syntax to ease the most traditional use cases.

    5. Blade Component Tags

    Laravel 7 enables you to build your individual components and employ them into the blade files as given below

    Defining the component

    <?php 

    namespace App\View\Components; 

    use Illuminate\View\Component;

    class Notify extends Component

    {

       public $type;

       public function __construct($type)

    {

          $this->type = $type;

    }

       public function classForType()

    {

          return $this->type == ‘success’ ? ‘notify-success’ : ‘notify-warning’;

    }

       public function render()

    {

          return view(‘components.notify’);

    }

    }

    Creating the  component tag

    <div class=”notify {{ $classForType() }}”>

    {{ $heading }}{{ $slot }}

    </div>

    Utilizing it in the blade files

    <x-notify type=”error” class=”mb-4″>

    <x-slot name=”heading”>

    Alert content…

    </x-slot>

    Default slot content…

    <x-notify>

    6. Laravel Airlock

    Laravel airlock is an innovative package capable of implementing an extremely light authentication system to single-page web applications, mobile applications, as well as easy APIs based on tokens. This package enables the users of the application to create numerous API tokens for their account. These tokens can define the abilities that specify what operations the tokens are permitted to perform.

    7. Query Time Casts

    Laravel 7 has introduced a function called “withCasts” that permit you to cast a value at the time of executing a query. An example can be seen as under

    $users = User::select([

      ‘users.*’,

     ‘last_posted_at’ => Post::selectRaw(‘MAX(created_at)’)->whereColumn(‘user_id’, ‘users.id’)

    ])

    ->withCasts([‘last_posted_at’ => ‘date’])

    ->get();

    8. Configuration of Multiple Mail Drivers

    One more excellent feature that has been included in Laravel 7 is that various mail drivers can now be configured in one application. Every mailer configured inside the mail configuration file can have its own unique advantages as well as an individual transport facility that enables your application to utilize diverse email services for sending emails. For instance, a Laravel application can now employ postmark for sending transactional emails and Amazon SES for sending bulk emails. 

    9. Cross-Origin Resource Sharing (CORS) Support

    Laravel can now automatically react to CORS OPTIONS requests with the values configured by you. You can configure all CORS settings in the CORS configuration file and OPTIONS requests will then automatically be managed by the HandleCors middleware, incorporated in your global middleware stack by default. The CORS support was presented by Barry vd.

    10. Customization of stubs

    Laravel 7 enables you to customize the stubs by making use of the artisan command. A new directory will be included in your project after executing the below command

    php artisan stub:publish

    11. Blade X feature

    The blade X features offered by Laravel 7 gives you the ability to create class-less components.

    Creation of X component

    @php($user = $user ?? Auth::user())

    @php($size = $size ?? 50)

    <img

        class=”inline-block rounded-full”

        src=”{{ $user->gravatarUrl($size) }}”

        width=”{{ $size }}”

        height=”{{ $size }}”

    />

    Usage of Blade X

    <x-avatar/>

    <x-avatar size=”40″ />

    <x-avatar size=”100″ />

    12. Custom Eloquent Cast

    Another great feature incorporated in Laravel 7 is custom eloquent casting that permits you to attach your own custom casts. Let us take an example below

    <?php

    use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

    class Json implements CastsAttributes

    {

        public function get($model, $key, $value, $attributes)

        {

            return json_decode($value, true);

        }

        public function set($model, $key, $value, $attributes)

        {

            return json_encode($value);

        }

    }

    We can now utilize our custom eloquent cast as given below

    <?php

    namespace App;

    use App\Casts\Json;

    use Illuminate\Database\Eloquent\Model;

    class User extends Model

    {

            protected $casts = [

            ‘extra’ => Json::class,

        ];

    }

    13. Fluent String Operations

    The Illuminate\Support\Str class, present in Laravel was proffering a number of valuable string manipulation functions so far. However, Laravel 7 has arrived with a fluent string manipulation library that has been included as the leader of these functions. Taylor Otwell was the one who created fluent String Operations.

    Conclusion

    Laravel is one of the most popular and frequently used frameworks for the development of web applications. Because of the amazing features it offers, it has found a corner for itself across almost all domains requiring web application development and the introduction of Laravel 7 has made it even more popular. 

    If you have still not tried Laravel, do try it for your next project. You can get in touch with our specialist team to get the best Laravel Development Services and create outstanding web applications by utilizing the most advanced version of Laravel i.e. Laravel 7.