Image for post
Image for post
Image from: https://rb.gy/oy1eeg

If you don’t understand Hindi, you’ll not get the featured meme here. And obviously, I am very bad at describing the role in that meme. Sorry, jokes on me as well. 😬

Back in my B.Sc. days, our RDBMS teacher, Mahfuz Reza Shuvo sir taught us a lot of things. Cursor, function, trigger, and a lot more. Can’t even name them now. Most of them are yet not being used now. But, when in trouble, then these things come up as blessings. Just a year ago, within a few hours of learning, I wrote a few cursors and functions that saved someone the next day. …


Image for post
Image for post
Image from: https://i.pinimg.com/originals/4e/73/01/4e7301538895cdc19b0eb5f2a3b60730.png

Suppose you have two microservices which communicate with each other and they reside in different network. Your microservice A has a PHP container. It needs to communicate with another microservice that is microservice B. They both reside in your host machine. How’d you do it?

On macOS, if you require communicating with your host machine from a docker container, you can just use docker.for.mac.localhost and use the port number. But I personally looked for the same in Linux, didn’t find anything. I don’t know how the docker.for.mac.localhost works. Found a few solutions for Linux. Check the solution below. And of course, I used docker-compose. The docker client has --add-host parameter which does the same thing for the following solution. …


Image for post
Image for post
Image from: https://miro.medium.com/max/700/1*NmdT4aRz4kW7mOMx_bzXQw.png

Whenever I am working on a project, if I can’t find a necessary package or some packages that don’t fulfill the requirements, I try to write the package which may in the future help other developers. So, before publishing into the packagist, I try to run it on my available Laravel/Lumen project to check if the integration is okay. That’s the reason when I need to install a package from my local machine to the Laravel/Lumen project.

To install a local/remote repository into your project, you’ll have to do only one thing in your composer.json file. Place the repositories key in the root of your composer.json file, and place an array of objects there. …


Image for post
Image for post
Image from: https://tableplus.com/assets/images/linux-alpha/tableplus-ubuntu.png

I have been using MacBook pro for the last 3+ years. Nah, those were never mine. Just the office’s device. But during the nights or weekends, I used to use my own HP Probook that has Ubuntu 18.04 installed on it. But, to be very honest, macOS and the apps are super awesome. From March till last week, I was using the office MBP and was fed up recently using that due to the RAM. MBP had 8GB of RAM and I had almost 20 docker services running simultaneously. Multiple Chrome windows, 4 instances of PHPStorms, Postman, Tableplus, and many more. If the laptop could speak, would have spoken out loud with swears. Out of anger, I thought to switch back to my HP Probook with 16 GB RAM and 240GB SSD. Now, Everything is running smoothly. But then I found another issue. There is no good DBMS Client for Ubuntu. After searching for hours, I found TablePlus is also available for Linux. …


Image for post
Image for post
Image from: https://rb.gy/o7hivl

Before writing this article, I went through my profile and found that I didn’t write any articles about JWT. JWT’s not mandatory here but could have self-promoted another article. But you can surely read my OAuth2.0 article. 😆

So, basically in OAuth2.0, the user authorizes third-party services to access their account for certain scopes that reside in the OAuth Service Provider. In this case Apple. …


Image for post
Image for post
Image from: https://bryanavery.co.uk/wp-content/uploads/2020/05/JWT.png

If you’re familiar with jwt and you want to implement jwt with Laravel/Lumen, you may know a few packages. But after knowing about the tymon/jwt-auth I didn’t look for any other packages. For the last two production applications, I have been using this package. I use this package because of its extensibility. Moreover, it does all sorts of validation out of the box.

I had to go through the codebase several times to get the most out of it. I had implemented the following using the package.

  • Had implemented a cache on the subject.
  • Had implemented passwordless user authentication.
  • Had implemented a storage-less authentication system for a gateway. …


Image for post
Image for post
Image from: https://youtu.be/vHQqQBYJtLI

Goal

The goal of the article is to create an API gateway, that doesn’t keep the state of the user in any storage, but authenticates using OTP based authentication. This way, the service calls behind the gateway are made sure that it is done by the authenticated users.

Why this or what are the use-cases?

If your gateway proxy is just doing the microservice calls to other services and assuming you have a user service, then you don’t need to keep any state in your gateway. Your user service will handle the states of the users based on the next calls. But before sending calls to multiple services, your user must be authenticated. So that you can keep track of who is calling which services. This authentication can be done in the gateway using OTP. This is my use-case. Yours can be different. …


Image for post
Image for post
Image from: https://mauricius.dev/images/composer.png

I use a few composer commands which sometimes I need to look at, by pressing the up arrow in my terminal. So, I thought I could group them up and write an article to share so that I don’t have to look for a list of commands to get the exact one.

If you’re running the install command from your local environment doesn’t fulfill the platform requirement ext-* but have it in your container then you can run the following which will ignore the platform requirement.

composer [require|update|install] --ignore-platform-reqs

If your containers run out of memory (Maximum allowed memory allocation problem) you can run the following command. …


Image for post
Image for post
By Mahmudul Hasan Shaon on https://unsplash.com/photos/QTPJWJBQO90

More than 3 years ago, I wrote a PHP package to read data from CSV and import that into the DB table. Upon finishing that, I wanted to do the vice versa. But didn’t pay that much attention. For the last 3 years, I tried rewriting that 2–3 times but couldn’t finish. This time, I started with full focus to completely rewrite the package and merge both the features into one package. Finally, today I finished both the features within 48 hours of continuous coding with 5.5 hours of sleep.

What does this package provide?

This package lets you insert records into multiple tables (if required) while reading data from CSV with less amount of coding required. On the other hand, this package lets you export data from multiple tables to a single CSV file. In both cases, you can compute on the fly and decide what can be the value that is not available in your data source but can be retrieved with a bit of computation on the available records. …


Image for post
Image for post
Image from: https://cloud.githubusercontent.com/assets/1801923/9915273/119b9350-5cae-11e5-850b-c941cac60b32.png

This is my fourth Laravel based Authentication related article till now. And, this is the second article for JWT based authentication with tymon/jwt-auth package. So, if you missed the previous articles or you’ve any quest to learn the Laravel’s authentication system, or you want to implement cache on your authentication system, then have a look at the following article links. Cheers.

History & what is this article about?

So, I was thinking to develop a system where you can users can log in without any password. Users will be given an OTP over the phone or an email and with that OTP you will let that user login. But, the shipped authentication system for the above package doesn’t support that. Without any customization, you’ll have to provide the username or email and the password to authenticate a user. So, this article actually provides the solution to achieve the goal. …

About

Syed Sirajul Islam Anik

procrastinator | programmer | !polyglot | What else 🙄

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store