Unity own backend

Hello, i had got idea to make my own backend for my games. i had read that, client shouldn’t get direct access to database, because it’s not safe. Let me explain things i want achieve
I want make a backend for my game/games in future, which could let me write and retrieve informations from database (the system must be multiplatofrm, i want it to work on mobile platforms + WebGL), i just got idea, that the game (client) could communicate with php scripts on the server, or any other backend scripts. Is that a good way to achive safe and multiplatform database access? What frameworks, languages, technologies should i use to make a multiplatform backend, which would allow me to access daatabase?

  • i don’t want make a big backend, just a simple one for my own ussage (like a
    leaderboard, save some user informations, etc).

There are a lot of php based leaderboards online for unity, google a little… it would be as safe as the php/sql code you use is.