Common code for Singletons using PHP’s traits

I hate singletons. Some say that singletons are not bad, instead “singletonism” is the evil.
I would argue. Anyway, I’ve been working on some common Singleton pattern code in PHP for a particular reason – I had to create common code for two basecodes:

  1. Laravel app using Facades
  2. some other custom API

Usage

→ Continue reading

Caching Partial View with View Composer in Laravel

Laravel 4 has got pretty nice Cache mechanism. Unfortunately, it’s nicety brings not too much functionality. It lacks a way to cache whole pages or partials.I have found nice plugin called Flatten which works on top of Laravel Cache and is able to do the job. What I desired was to cache partial view and also cache it’s data being created by View Composer.

→ Continue reading