This is a collection of handy PHP traits. These are all stand alone components, without any dependencies, that can be dropped into any project.
Requires >= PHP 5.4.0 as it uses traits. Collaborators / pull requests welcome.
- ClassExtras - add utility methods to a class
- Decorator - decorator design pattern: add behaviour to an object dynamically
- Logging - log messages to 1 or more logs
- Options - get and set an object's options
- Singleton - design anti-pattern
- ToString - safely convert an object to a string
Use packagist - put this in your composer.json
{
"require": {
"createopen/traits": "dev-master",
}
}
- Hook / event
- Benchmarking
- ArrayAccessible / Iterator / Countable / Traversable / Filter
- ORM / DataMapper / ActiveRecord
- Cache
- Template
- Foldl
- Monads: Maybe, Collection