Member-only story

Why I don’t like using static in PHP

Atakan Demircioğlu
Jotform Tech
Published in
4 min readJul 5, 2023

In summary, I don’t like using static classes in PHP. In this article, I will try to explain why.

Photo by Jose Aragones on Unsplash

How did it start?

When I started coding, I worked on a legacy project. In this project, I saw a lot of static usage, and I started to associate it with older, less efficient code. That is the biggest problem that I saw in newbies in programming but like 3 years ago I was doing the same.

One day I had a chance to develop a new project from scratch. I decided on the project structure and the whole backend side. I knew it was a big responsibility because if I made a bad decision, I’d be the only one responsible for it in the future :).

So I did my best and asked developers whose experience and knowledge I trusted what they thought as I went.

They all said, “Don’t use static.”

“Don’t use static”

I asked why and started to research why static would be a problem. Some of my findings are deprecated problems, but I want to share what I found.

1. Static methods make classes tightly coupled

Let’s start with an example. I asked Chat GPT for this example.

class DatabaseManager {
public static function connect() {…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in Jotform Tech

Welcome to Jotform official tech blog. Read about software engineering and how Jotform engineers build the easiest form builder.

Written by Atakan Demircioğlu

Passionate about blogging and sharing insights on tech, web development, and beyond. Join me on this digital journey! 🚀

Responses (3)

Write a response