Teknasyon PHPKonf 2023 Summary

Teknasyon PHPKonf 2023
1024 1024 Ahmet Onur

I just attend to Teknasyon PHPKonf 2023 that took place in Istanbul Kultur University. It was really absorbing. Speakers have provided valuable information, insights, or experiences related to PHP programming or technology in general. You can be informed about some of talks in this post.

Real-world Async Cases with Fibers – Mert Şimşek

This is about the fibers feature of PHP to add ASYNC behaviour. Fibers feature is like Promise from JavaScript. They can start, stop, resume and cancel if you wish. You can prioritise jobs by using fibers. It expects the callback function to execute. You can check fibers documentation out here.

Event-Driven State Machines – Yunus Emre Deligöz

Every programmer definitely uses conditions to manage the state of class. For example, if you want to program traffic lights in code, you have to keep traffic lights’ state status and then manage behaviours and its effects. Firstly, you can do this with if/else conditions but it makes things hard to write tests and means that you have to write tests for every conditions and condition combinations.

State machines is an approach like OOP to program these stateful mechanisms by keeping the codebase clean and durable. This is called finite-state machines.

Assume that we have http fetch service. This has states (not started, fetching, success, error) and behaviours (fetch, success, refresh, error). When we need to send http request, this machine has to change its state to “fetching” and while it is happening, it shouldn’t accept new http fetch requests. And then according to result of request, it should be changed to success or error states. Thanks to state machines, we can implement behaviours and make state changes without using conditions.

Teknasyon PHPKonf 2023 state machines

NOTE: If you want to use packages for that, there are config, behaviour, definition and actor elements.

NOTE: Guards are responsible for controlling whether behaviour is possible to do. If it isn’t, the guard rejects the action.

RESOURCE: Speaker has also shared slide and resources here.

Dealing with High Traffic: Experiences in Redis and PHP – Ali Özkan

–latency command

Latency is great command to check maximum delay between issuing command and the time the reply to the command.

When Redis is loaded high requests, to handle it:

  • AOF should be turned off
  • RAM should be prevented to reach maximum memory to keep redis up, so we should set eviction policy to “noeviction” because other eviction policy values might not keep up with redis memory. For example, if we set it to “volatile-ttl”, redis might not handle sorting of keys and deleting them in order while new keys are coming to Redis, so the solution is writing own redis key manager to guard incoming new keys if redis can’t put them.
  • If we scale the redis up in order to keep new keys inside, it might not be useful when we reach scaling threshold. We can open new places for new keys while extending RAM; however, CPU increment doesn’t help the redis to put, read or update keys because redis is single-thread. Every requests are handled in sync and after threshold, the redis can’t handle it.
  • The solution is using redis cluster feature. The cluster feature creates new virtual instances and manages keeping keys on them. For example, if y0u want to a key that called “AHMET” on Redis, it checks whether the key is in cluster 1 or not. Then if it is not, it looks another clusters automatically to find.

NOTE: After adding new clusters to Redis, we should allow it to know them. At the beginning, they won’t receive new keys and we have to move slots to new clusters in order to active them. You can check clusters with cluster info command. In short, cluster_size and cluster_known_nodes properties should show same counts. If they are not same, it means that you have not activated clusters.

Introduction to Mutation Testing – Can Vural

Code coverage checks don’t show code and test quality. It is only show that which parts of your code tested. Anyway, it doesn’t let us know that it doesn’t cause any problem when it is published.

Mutation tests help us to measure quality of our tests. Basically it changes code and generate new mutations, then test scenarios, so we can be sure about our code in order to deploy to production. Disadvantage of the mutation test is slowness. Compared to unit tests it lasts long and if possible we should test our code partially.

Transforming the Past: Refactoring Adventure of a 5-Year Project – Görkem Duymaz

We should create regression tests for every refactoring change in order to check whether new code and old code have same functionality or not.

And also some points that we need to be careful while working on refactoring:

  • Should be prepared to refactoring process
  • Should avoid to do thing that comes to mind first. It should be planned and refined well.
  • Refactoring is not one-time job. It is actually mindset and should be planned as a process and in time this mindset should be implemented.
  • Dependency is a dangerous point while making refactor.
  • Deployment of refactored code should be made partially and avoid to wait until completing all of code.
  • Performance tests should be done to not have inefficient code
  • Code analysing should be prioritised
  • If you continue adding new feature while working on refactoring, you should follow same mindset to keep debt less.
  • Documentation is so important and we should keep it updated.

Beyond Controllers in Laravel Projects: Finding the Right Place for Logic – Mücahit Cücen

In this talk, presenter generally told that laravel documentation, so i will list some of points.


Traits are like abstract classes. Difference between them is trait classes are not specific purposes, so they can be used in different modules and domains but abstract classes are domain based. Anyway, you can inject them to your parent class and use their behaviour in it.

Repository classes pattern in Laravel

You should avoid from using this pattern in Laravel. Implementation of this pattern is actually service architecture but this causes performance issues and complicated codebase.

Thank you for reading my post about Teknasyon PHPKonf 2023 summary. If you want to make contribution to this post, don’t hesitate to reach me.

  • Posted In:
  • PHP

Leave a Reply

Your email address will not be published.