DEV Community

Arshid
Arshid

Posted on

πŸš€ Traitify – Native PHP Traits in C

Traitify is a PHP extension that brings native, high-performance traits, such as Singleton, to PHP using C. It’s faster, lighter, and designed for real-world use in modern PHP apps.

πŸ”§ Features

βœ… Traitify\Singleton trait in C

βœ… Automatic getInstance() handling

βœ… Full __construct() support

πŸš€ Skips PHP overhead

🧠 Extensible: add Macroable, Singleton, etc.

πŸ“¦ Install

git clone https://github.com/arshidkv12/traitify.git
cd traitify
phpize
./configure --enable-traitify
make && sudo make install
Enter fullscreen mode Exit fullscreen mode

Enable in php.ini:

extension=traitify
Enter fullscreen mode Exit fullscreen mode

βœ… Why Use It?

  • Faster than PHP traits
  • Less memory usage
  • Clean API
  • Ideal
  • for performance-critical apps

πŸ”— GitHub: github.com/arshidkv12/traitify

Fork it. Test it. Extend it.

Top comments (0)