Generally, it's a good idea to create your own server behavior if the following two criteria are met:
The goal you want to achieve with a piece of PHP code is not present on the predefined list of server behaviors.
You find that you are often writing the same kind of PHP code, with only a few things that change each time.