Anjan's Blog

Code & Read

Fixing mdpf locked to php 8.2 issue during a new composer package install or update

While updating composer or installing a new package, we often get stuck with this –

./composer.json has been updated
Running composer update zircote/swagger-php
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - mpdf/mpdf is locked to version v8.1.3 and an update of this package was not requested.
    - mpdf/mpdf v8.1.3 requires php ^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 -> your php version (8.4.1) does not satisfy that requirement.

To get over this just trying to fully update these packages (like mpdf) here with all dependencies –

composer update mpdf/mpdf --with-all-dependencies

If the packages are not dead and still maintain to match php version, you will be able to get the latest version updated to match your current php version.

AdonisJS Setup for Node API Server

Adonis is very sensitive and node version mixup. You will literally lose access to all node ace commands! So be very careful with this!

First make sure that node version is 24.x. Then create desired folder and enter it. Here we will use adonis-test as folder name

mkdir adonis-test && cd adonis-test

Then type the init command to start setup –

npm init adonisjs@latest . -- --db=mysql --kit=api

On setup screen, select Access Token for authentication guard and let setup continue.

After setup is done run npm run dev and go to http://localhost:3333/ if you see the test { “hello” : “world”} JSON, its ready to run

We are then going to do a GIT init and first commit. Just in case anything goes wrong and we need to revert. This thing is damn troublesome!

Use this as a starter .env file content. Of course, set proper values for database, generate key, etc.

TZ=UTC

PORT=3333
HOST=localhost

LOG_LEVEL=info

# use node ace generate:key to generate key ...
APP_KEY=YOU_APP_KEY

# node environment
NODE_ENV=development

# Database info ...
DB_HOST=localhost
DB_PORT=3306
DB_USER=YOUR_DB_USER
DB_PASSWORD=YOUR_DB_PASS
DB_DATABASE=YOUR_DB_NAME
DB_SOCKET_PATH=SOCKET_PATH_IF_USE_ANY

If you are using mysql socket (like working with MAMP on Mac OS), be sure to add socket path in config/database.ts like this –

import env from '#start/env'
import { defineConfig } from '@adonisjs/lucid'

const dbConfig = defineConfig({
  connection: 'mysql',
  connections: {
    mysql: {
      client: 'mysql2',
      connection: {
        host: env.get('DB_HOST'),
        port: env.get('DB_PORT'),
        user: env.get('DB_USER'),
        password: env.get('DB_PASSWORD'),
        database: env.get('DB_DATABASE'),
        socketPath: env.get('DB_SOCKET_PATH'),
      },
      migrations: {
        naturalSort: true,
        paths: ['database/migrations'],
      },
    },
  },
})

export default dbConfig

Otherwise, adonis wont connect to database, and you might waste a lot of time scratching your head.

Remove a folder from GIT repository by keep locally

Ever had a situation where a folder accidentally ended up in your GIT repository. I am not talking about those folders which are hidden with GIGA bytes sized worth files 😉 These folders should not even be near your repository!

I am talking about innocent but unwanted folders. For example, the .idea folder that is created by lovable PhpStorm IDE that we all love. This folder should definitely not be in GIT! Why you ask? because if it is checked out by another person using PhpStorm as well, it could give them some potential trouble! That’s a big NO NO for you little repo, that you want to share with others. This is my personal experience. Unfortunately from both ends!

So, to remedy this, we have to make sure 2 things. First, I want the folder in question to be gone from GIT repository. Second, most importantly I have to keep this folder on my local, or i have to say bye bye to PhpStorm project config and spend some time to reconfigure it. In worst case, if you are not careful, you may delete an important folder locally, then push it to repo and all hell breaks loose! I have seen quite a few Redditer doing panic posts like “I deleted this folder accidentally, now what do i do?” It may or may not be unrecoverable, but it SURE does give you a solid scare!

Now on to how to purge the folder on repo, but to keep it locally, we just need to do this –

git rm -r --cached .idea

For your case, just replace the .idea with your own folder name. Please DO note that –cached flag! if you skip it, you sure are gonna receive some tough love from your boss or team leader. If none of them are present, you will SURELY want to kick yourself. Why the flare? Its just because, if you missed the –cached flag, and run a command like git rm -f .idea, then you will remove it from repo alright, and as a bonus you will remove from you local filesystem, too!

So, after all that warning out of the way, and git cached version of the folder (The .idea in current cache), how it is time to tell github (or any other git repo) politely that you no longer want that folder there. So, just do a plain old git add and then git commit, this will allow github to update your repo.

That’s it! And, we are done (in a bit!)

P.S. If you want to ask AI about this, be sure to prepare your prompt to something like this –

I have accidentally added .idea folder on my github git repo, now i want to remove it completely from local and remote repo, but want to keep that folder in my local filesystem. how do i do it?

From there you can explore more on the topic. Now, we are truly done!

© 2026 Anjan's Blog

Theme by Anders NorenUp ↑