Laravel Livewire V3 – Getting Started (1/3)

Livewire is a Laravel package to make powerful, dynamic, front-end UI. It offers a convenient way of building SPA-like interactive apps with PHP (without writing JavaScript).

On July 20th of 2023, at Laracon US, the new shiny Laravel Livewire v3 is officially released. With the new Alpine based core and a bunch of new features – it’s going to be awesome!

Let’s explore the fresh, out-of-the-oven Livewire. ♨️

We are going to build a Fortune Cookie Message app. These are small, inspirational, positive messages printed on paper and served inside specially shaped cookies. See the story here.

FortuneCookieMessage app with Laravel Livewire V3

We’ll make it in a 3 step journey with the following milestones:

  1. Make a new Livewire app. Show up a different inspirational message every time we hit a button.
  2. Add an Emoji reaction counter. Explore various livewire features.
  3. Make an admin section with authentication and a data grid.

It’s small enough to try and complete within a day but has the scope of exploring various interactivity features.

Continue reading →

Laravel Gates – a graphical intro for beginners

Gates! The first impression it makes is “way to enter somewhere”. But, in reality, the primary responsibility of a gate is to prevent unwanted entry. Another perspective of thinking about gates is – different gates will take you to different places.

Laravel picked this word, “Gate” to name its basic authorization system. What a beautiful similarity between the purpose of an authorization system and the real life gates!

In this post, we are going to:

  • Take a simple application as an example scenario.
  • Identify the usages of authorization in this application.
  • And then, how we can solve it using Laravel Gates.
Continue reading →

New Laravel app with a head start from CLI

Sometimes, we want to quickly try out a new product idea. But where to start? 🤔

Just open your terminal, copy-paste the following commands, and you’ll get a basic Laravel app in 5 minutes. Additionally, it’ll have some basic things ready like login, registration, user profile, user listing, etc. Ready to build anything upon this base.

Now, it’s your time to focus on your very own idea. 🚀

Continue reading →

How to get all indexes of a table in Laravel

You can list all indexes of a table, along with the field names in Laravel. It’s very quick and easy with DB Facade and Laravel Collection.

Here is the code you’ll need. Right, just a single, chained statement! 😉

use Illuminate\Support\Facades\DB;

collect(DB::select("SHOW INDEXES FROM products"))
    ->mapToGroups(fn($row) => [$row->Key_name => $row->Column_name])
    ->toArray();

The output will be something like the following.

Continue reading →

E-Code Verifier relocated

E-Code Verifier is a free web application for checking/verifying Shariah status (Halal, Haram, Mushbooh) of E Code (food ingredient codes). It was developed as a PWA and published in Jun 2016 at ecode.halal-haram.com. By the time of July 2018, it was hitting 12k+ traffic monthly from search engines (without any kind of promotion) and also a good number of usages from desktop/mobile installations.

E-Code Verifier Analytics of 2018
E-Code Verifier Analytics of mid-2018

A few months ago, the domain “halal-haram.com” got expired! And I have been very busy at that time and didn’t notice! When I realized it, it’s already too late to recover. So, I have relocated it to ecode.figlab.io.

I hope it will become useful again and will save thousands of Muslims from consuming foods with haram ingredients unintentionally.

A free, hosted, advanced wiki – Dropbox Paper

Around a year ago, while starting a new project, I was asking a friend and colleague for a suggestion between Docuwiki and Confluence to use as team wiki. He suggested trying Dropbox Paper instead. I’ve tried, and the result was amazing!

Since then, using it as the team wiki for several projects happily. In this post, I’ll share some of the points which convinced me to use Dropbox Paper as a wiki (or alternative of wiki) for a team.

Why Dropbox Paper?

Take 3 minutes to go through the following points and screenshots. Hopefully, you’ll find Dropbox Paper a good fit for many of your situations where you’ll use a wiki.

Continue reading →

Merge Images and PDFs into PDF

When working with PDF documents or scanned images, it’s a pretty common task to merge them to PDF. We have been doing these things using imagemagick and ghostscript for years. But we had to compromise with a few serious drawbacks of that process including converting PDF pages into image snapshot and increasing file size. So, eventually, I have written merge2pdf a tiny cli tool for this job (and a few extra).

This post is to show some example usages (commands) of this tool for different scenarios.

Highlights

Before diving into commands, let’s go through a list of highlights of this tool.

  • Lossless quality by default. Option to adjust JPEG quality
  • Can be merged all pages or only specific pages of PDF
  • Supports a wide range of image formats
  • Options to adjust size, margin, and scaling of images
  • Supports directory as input (merges all Images/PDFs of a directory)
  • Free and open source
  • Very simple and easy to use

Continue reading →

Backup your database periodically to free cloud storage

Database Backup Mega.nz

You want to keep a periodical, automatic backup of your database. And, for safety, you are thinking to keep these backups to a (preferably free) cloud storage. Then this post is for you ?.

It can be done in thousands of ways. But, I am trying to show you an easy, almost effortless process. Just bear with me for 10 mins and you’ll see it’s happening.

Let’s start.

Continue reading →