Blog: Put Your Behaviors On Steroids
Propel is bundled with a lot of great behaviors. All of them are real behaviors, not just extensions, that's why it's really powerful. You can customize every generated class without any effort thanks to hooks, and filters.
To write a behavior is easy, you just have to read the dedicated documentation page, and you'll be ready to write awesome behaviors. Don't forget to look at user contributed behaviors before to start, maybe someone already wrote what you need.
A behavior adds logic to your model layer so it must be unit tested. Most of the time, you will have to rely on the PropelQuickBuilder to setup your test suite. This builder will build classes for a given XML schema. The code below shows an example of a test class:
The MyObject class is created in memory, and you can use it as usual in your code. The next step is to make your behavior easy to install. The best option is to rely on Composer:
The convention here is to prefix your package name with propel-, and to suffix it with -behavior. Please, follow this convention. Don't forget to add Propel as requirement, and you will be ready to add it on Packagist.
That's all! You know everything to build great behaviors.