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
read_api is a minimum.
api will work too. If you want to set an expiry, can put value in that. …
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. …
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. …
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 client has
--add-host parameter which does the same thing for the following solution. …
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. …
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. …
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. …
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.
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.
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. …
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. …