PWA, WebAssembly and GraphQL – 2018 new tech trends and what a web developer needs to know

After another tech giant Facebook adapted the PWA, it seems PWA has become one of the most popular technical terms for current web development.

Reference: “Facebook takes first steps in Progressive Web Apps (PWA)”

 

As you can see there are two trends for the web development in 2018 that you (a web developer) should be very well aware of:

  1. PWA – will be integrated to Magento 2.3 with PWA studio – this will instantly enable most of PWA features for Magento on mobile platforms
  2. GraphQL – this is another Facebook invention, it’s becoming more and more popular and it's going to replace RESTful API and XML based web services.

 

By the end of the year PWA and GraphQL would be very likely to become main stream since more and more big players are coming onboard.

 

Coming from a PHP / Laravel background I’ve leant Vue.js and used it in the production, however Magento 2.3 will be released with React as the front-end PWA choice. What's more, because React had performance advantage over other frameworks, so if you are new to PWA, maybe it’s the best choice to start learning React PWA since learning it could provide the best value return in the near future.

 

Just quote it here from “What to Expect from Magento in 2018” (https://trellis.co/blog/expect-magento-2018/):

“In mid-2018, Magento will introduce Progressive Web Applications (PWA) to the platform with Magento PWA Studio. The suite of tools will allow users to build online stores as PWA’s and serve as a learning tool for developers.”

……

“The studio will introduce the new GraphQL 1.0 API style to the API collection.”

For more information, you can read about Magento PWA Studio here.

Further reading:

First Windows 10 Progressive Web Apps (PWA) published by Microsoft hit the Store https://www.windowscentral.com/first-batch-windows-10-progressive-web-apps-here

On the other hand, Golang has officially added the WebAssembly architecture to its road map and had the first commit to the compiler not long ago. Here is the technological statement of WebAssembly architecture for Go.

The WebAssembly architecture will allow Go to become an alternative to JavaScript for writing code that runs in a web browser. This new freedom of choice will hopefully have a positive impact on the software engineering ecosystem overall.

Now it's becoming more interesting.

Laravel Tinker Shell – Access a Laravel controller function through command line

Laravel Tinker Shell is an interactive command like tool that allows you to run a controller function directly via the command line.

Let's see an example below:

Say you have a controller as such: App\Http\Controllers\SomeController

Within it, there's a function call SomeFunction().

Now you want to access SomeFunction() via the Tinker command line:

php artisan tinker

$controller = app()->make('App\Http\Controllers\SomeController');

app()->call([$controller, 'SomeFunction'], []);
// the SomeFunction function is called
// the second param array [] is used to hold the parameters
// leave it empty if there's no parameter.

app()->call([$controller, 'SomeFunction'], [param1 => 321]);
// this is how the parameters are passed in

So you can see the outputs from the command line directly, this is very helpful for testing. However if  you want something permanent you probably may like to make a custom artisan command for long term use.

Laravel Tinker Docs