I am a PhD student in electrical engineering and I am writing my first article, probably for a Q1 journal. My question is the following: in order to get a PhD degree, do you need to have one or several publications? Is this a typical requirement, or does it depend on the university where you are doing it?
This depends on both the field and the university, or even the department within the university. In math, for example, such a requirement is rare. In some fields a "dissertation" is precisely a collection, perhaps three, of published papers with some summary material.
If you weren't yet in a program then a publication would help with an application, but it may not "count" toward graduation. Since you are already in a program ask locally and be sure about the requirements. Hopefully you have an advisor who can provide details.