Image for post
Image for post
Image from: https://codereviewvideos.com/blog/wp-content/uploads/2015/06/composer.gif

I had to install a PHP package that’s not hosted on packagist. Rather, it stays under my organization’s private repository on Gitlab. So, I thought to write an article that can be easy for others if they’re going through the same.

So, to install a package from GitLab which is not a public repository will need a Personal Access Token. You can issue your PAT by going to Profile Icon > Settings > Access Token. Then to issue a new PAT, write a name and select a scope api/read_api, read_api is a minimum. api will work too. If you want to set an expiry, can put value in that. …


Image for post
Image for post
Image by KS KYUNG on Unsplash

Suppose you’re working for a client or implementing an OAuth. You need your application to be available publicly on the internet. And, if you’re working with OAuth, it requires you to register your redirect callback URL with TLS support. In both these scenarios, if you don’t have any server set up already, you need a way around. There can be other scenarios. In all those scenarios, you somewhat require to push your local codebase to the server. And if you don’t have a server right now, you can use a few open-source or freemium services to achieve the goal. I’m going to list a few services below. There are a lot. And, you can even implement the same thing of your own if you have a VPS set up. Moreover, none of them are bound to any specific programming language. …


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. …

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