Skip to content
A simple script for caching 3rd party API calls in PHP.
Latest commit eb43b12 Jul 15, 2014 @gilbitron v1.4.1
Adding namespace and PSS-4 support.
Failed to load latest commit information.
src v1.4.1 Jul 15, 2014 v1.4.1 Jul 15, 2014
composer.json v1.4.1 Jul 15, 2014

PHP SimpleCache

The PHP SimpleCache Class is an easy way to cache 3rd party API calls.


Install via composer:

    "require": {
        "gilbitron/php-simplecache": "~1.4"

Run composer install then use as normal:

require 'vendor/autoload.php';
$cache = new Gilbitron\Util\SimpleCache();


A very basic usage example:

$cache = new Gilbitron\Util\SimpleCache();
$latest_tweet = $cache->get_data('tweet', '');
echo $latest_tweet;

A more advanced example:

$cache = new Gilbitron\Util\SimpleCache();
$cache->cache_path = 'cache/';
$cache->cache_time = 3600;

if($data = $cache->get_cache('label')){
    $data = json_decode($data);
} else {
    $data = $cache->do_curl('');
    $cache->set_cache('label', $data);
    $data = json_decode($data);



PHP SimpleCache was created by Gilbert Pellegrom from Dev7studios. Released under the MIT license.

Something went wrong with that request. Please try again.