Author: bandel

  • What Is Laravel Jetstream And Why Is Every Laravel Development Company Talking About It

    Laravel is an open-source PHP framework and it keeps adopting new versions to perform on various projects. After Laravel 7.27.0, Laravel 8 projects are going to float over the internet. Here is a brand new Scaffolding package for Laravel 8 projects that are named ‘Laravel Jetstream’ for every Laravel development company to use. Laravel Jetstream is an open-source package derived by the Laravel team. This free package goes beyond Authentication Scaffolding.

    Now, Laravel Installer includes support for Jetstream. The latest Laravel version 8 is coming into existence with a new feature Laravel Jetstream to set it with better improvements. This enhances the Laravel development services by performing in the changed package of Laravel/UI.
    With the latest version, Laravel is moving ahead from the jQuery and Bootstrap based scaffolding. Laravel was stuck to these scaffolding and the change was indeed needed. Laravel Jetstream is the one that not only brings the change but also gives a more intuitive way of development to Laravel developers.

    The Change Cum Revolution with Laravel

    • Laravel Mix helps to compile SASS files to plain CSS. The ‘package.json’ of Laravel includes the ‘bootstrap’ package after installing the ‘laravel/ui’ composer package. It further generates the frontend scaffolding. Now, on the other hand, Laravel Jetstream has changed the things from Laravel/UI package. Tailwind has taken the place for CSS. Tailwind CSS is a low-level CSS framework, which is highly customizable too.
    • Developers use ‘Presets’ to handle frontend. They allow developers for adding additional methods to the ‘UiCommand’ class at runtime. Presets are ‘macroable’ that needs to be declared in a service provider. Laravel Jetstream includes ‘Inertia.js’ or ‘Livewire’ to replace presets in Laravel/UI.

    Tailwind

    Tailwind is a highly customizable and utility-first CSS framework. It helps to build rapid custom designs. Tailwind serves the developers with bespoke designs where they need not to worry much about those annoying opinionated styles.

    Most CSS frameworks perform too much with all sorts of predesigned components. They often create a mess with cards, buttons, and alerts, etc. When a business looks to hire Laravel developer, it needs to make sure whether the team can perform with customer design or not. But Tailwind is so different and easy to optimize. It provides low-level utility classes and replaces the opinionated pre-designed components.

    Tailwind drives custom designs without ever leaving HTML. This is completely your thing if you are just fed up with battling specificity wars, overriding unwanted styles, etc. Listing a few features of Tailwind that are contributing to making it different –

    Livewire

    Livewire is a full-stack framework that helps the developer for building dynamic interfaces. Every business looks for modern app development. This development becomes much hard with tools like Reach and Vue. Though these tools and extremely powerful, the complexity causes fatigue.

    Livewire comes with the comfort of Laravel. If you will into its codes, you can find out the difference and uniqueness of performance. It keeps improving with the real-time search component that the user sees after typing into the search input.

    It works swiftly and the performance is here –

    • SEO friendly performance with the page
    • AJAX request to the server at an interaction
    • Mutates DOM as the things changed

    Inertia.js

    Developers can build single-page apps with Inertia.js. There is no such requirement of building an API as Interia.js lets you build modern single-page apps with React, Vue, and Svelte. A Laravel development company uses classic server-side routing and controllers to perform the required task.

    First of all, Inertia.js is not a framework. This is completely a new approach, also known as a modern monolith. It neither has client-side routing nor requires an API. Inertia performs by leveraging existing server-side frameworks. Developers can simply build controllers and page views.

    There are three official client-side adapters where the developers actually perform. These are Vue.js, React, and Svelte. Additionally, two server-side adapters are also here Laravel and Rails. Inertia is designated to work with existing client-side and server-side frameworks. Inertia comes with Vue.js as a default adapter.

    Availability of Laravel Jetstream

    Laravel keeps evolving with its various versions. These versions are coming with some revolutionary changes, every time. Laravel team brings major changes with its every version. They keep a 6-month interval between their two Laravel versions’ releases. Laravel 8 Non-LTS is a general version that provides six-months bug fixes and one-year security-fixes. WebOccult keeps itself informed and equipped with every technological development in the relevant realm.

    Since the latest version of Laravel is Laravel 8, the expectations for Laravel Jetstream also revolve around that date. 8th September 2020 is the date when Laravel 8 is coming out with some supreme features. Laravel Jetstream can also follow it after the arrival or one/two weak later. Thus, it is just nothing to hire a Laravel developer. A business must ensure that the developer (or development team) is well-aware of every latest technology and versions before hiring them.

    Features of Laravel Jetstream

    Laravel Jetstream offers amazing scaffolding for Laravel applications. It is a new Laravel ecosystem. This open-source platform is completely free for developers. Laravel Jetstream includes much cool and development-friendly stuff. A few of its useful features are mentioned below –

    User Profile Management

    User Profile Management is, somehow, the key feature of Laravel Jetstream that sets it different from others. Here, the user can update various relevant information, easily. It includes information like –

    • Users can update a profile picture.
    • Users can update their name, along with email and password.
    • Users can view the Browser Sessions and log out from there.
    • Users can delete their account, completely.
    • Developers enjoy full control as all functionality and its code is available to them.
    • Two Factor Authentications is available with Recovery codes and QR code.

    Team Management

    Though it has been very usual that developers do use the ‘teams’ feature in every SAAS application, Laravel Jetstream has clubbed it in a very unique as well as a better way. It adds ‘teams’ entry in the ‘jetstream.php’ config file with to enable you to –

    API Tokens

    This is an ultimate feature of Laravel jetstream where it uses Laravel Sanctum to generate API tokens, under-the-hood. A Laravel developer can perform by adding a single line of code in the ‘jetstream.php’ config file to enable the user form generating their own tokens. Even if it is not required, if your Laravel app exposes an API, the developer should give this flexibility to its users.

    With the suggested configuration, a new page will be added automatically, namely, user/api-tokens. Additionally, the user can also manage token permissions on this page, which are defined in ‘JetstreamServiceProvider’.

    Final words

    Laravel 8 is going to give a kick to Laravel development. Laravel Jetstream is like a non-billing part of Laravel Spark that is offered by the Laravel team. Since the intuitive and futuristic approach of the team is unquestionable, Laravel Jetstream can add much more to the Laravel development. We, at WebOccult Technologies, provide unerring Laravel development services to the clients where we keep adopting every new trend of the technology.

    All we can say is that Laravel Jetstream will work effectively. It looks quite appealing and promising in the first look, let’s see how far it walks with us!

    Originally published at https://www.weboccult.com.

    Source: https://mahipal-weboccult.medium.com/what-is-laravel-jetstream-and-why-is-every-laravel-development-company-talking-about-it-a0635d43d572

  • Getting Started with Redis As A PHP (Laravel) Guy Or Girl

    What is Redis?

    Redis which stands for Remote Dictionary Server is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.

    In basic words, Redis is a Key-Value Store that stores data in Key-Value pairs.

    For Example:

    How data is stored in Redis

    Redis is a No-SQL database.

    Basically, this means it does not have tables, rows, columns, functions, procedures, etc like in MySQL, Oracle DBs

    It also does not use SELECT, INSERT, UPDATE, DELETE.

    Instead, it uses data structures to store data.

    Like,

    • String
    • Lists
    • Sorted Sets
    • Hashes
    • Sets

    And,

    • Bitmaps (also called bit arrays, bit vectors, etc.)
    • Hyperloglogs ( It’s is a probabilistic data structure used to count unique values — or as it’s referred to in mathematics: calculating the cardinality of a set)
    • Geospatial Indexes (The geospatial index supports containment and intersection queries for various geometric 2D shapes.)

    Interaction with data in Redis is command based.

    One of the key differences between Redis and other key-value databases is Redis’s ability to store and manipulate high-level data types.

    Redis is a popular choice for caching, session management, gaming, leader boards, real-time analytics, geospatial, ride-hailing, chat/messaging, media streaming, and pub/sub-apps.

    To learn more about Redis you can visit their website, redis.io.

    Getting Started

    For this post, I’ll be working with Ubuntu 18.04 but any Linux Distro works.

    You’ll need PHP (Laravel) installed, Follow the instructions here to get it installed https://panjeh.medium.com/install-laravel-on-ubuntu-18-04-with-apache-mysql-php7-lamp-stack-5512bb93ab3f;

    For test purposes, You’ll also need Redis installed locally.

    To do this simply run,

    sudo apt-get update

    Then,

    sudo apt-get install redis-server

    Finally;

    sudo systemctl enable redis-server.service

    One more thing,

    sudo nano /etc/redis/redis.conf

    Optionally, you can increase or decrease the memory limit is available on your host machine.

    maxmemory 256mb
    maxmemory-policy allkeys-lru

    Then finally restart your Redis server.

    sudo systemctl restart redis-server.service

    and start it up by running

    redis-server

    By default, it runs on host: 127.0.0.1 and port: 6379.

    Finally, Getting Started

    We’ll be using a test project for our example.

    • So open up your terminal with CTRL+ALT+T, and type in the command below in the directory of your choice;
    composer create-project — prefer-dist laravel/laravel redis-example
    • Navigate to the folder
    cd redis-example

    Install the predis/predis package via Composer

    composer require predis/predis

    Configuration

    The Redis configuration for your application can be found in config/database.php. In this file, you’ll find a Redis array containing the Redis servers utilized by your application.

    'redis' => [
        'client' => env('REDIS_CLIENT', 'predis'),
    
        'default' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_DB', 0),
        ],
    
        'cache' => [
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => env('REDIS_CACHE_DB', 1),
        ],
    ],

    The default configuration uses phpredis as it’s client, so you’ll have to change this to predis if you’ll be using the laravel predis package.

    Interacting with Redis

    You can interact with Redis by calling various methods on the Redis facade.

    Redis facade supports dynamic methods, basically, this means that you could call any command on the facade and the command will be passed directly to Redis.

    Here’s an example,

    namespace App\Http\Controllers;
    
    use App\Http\Controllers\Controller;
    use Illuminate\Support\Facades\Redis;
    
    class UserController extends Controller
    {
        /**
         * Show the profile for the given user.
         *
         * @param int $id
         * @return Response
         */
        public function showProfile($id)
        {
            Redis::set('name', 'Taylor');
            $values = Redis::lrange('names', 5, 10);
            $name = Redis::get(‘name’.$id);
            // $values = Redis::command('lrange', ['name', 5, 10]);
            $user = [
                'name' => $name,
                'values' => $values
            ];
    
            return view(‘user.profile’, [‘user’ => $user]);
        }
    }

    For more commands like this, you can check out the laravel documentation on Redis here

    Source: https://olat-nji.medium.com/getting-started-with-redis-as-a-php-laravel-guy-or-girl-6a8d875a4166