PHPackages                             h-space/api-cacher-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. h-space/api-cacher-bundle

ActiveLibrary[Caching](/categories/caching)

h-space/api-cacher-bundle
=========================

Api requests smart cacher for perfomance optimization

16PHP

Since Mar 27Pushed 11y ago1 watchersCompare

[ Source](https://github.com/nikos90/ApiCacherBundle)[ Packagist](https://packagist.org/packages/h-space/api-cacher-bundle)[ RSS](/packages/h-space-api-cacher-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ApiCacher Bundle
================

[](#apicacher-bundle)

ApiCacher is a symfony2 caching system for data provided by API endpoints. It is used for optimising the performance of a website that uses external API services for data.

### Installation

[](#installation)

Composer:

```
"require": {
        "h-space/api-cacher-bundle": "dev-master"
    }
```

```
$ composer install
```

### Usage

[](#usage)

Include the library:

```
    use HSpace\Bundle\ApiCacherBundle\Library\ApiCacher;
```

Initialize class:

```
     $cacher = new ApiCacher();
```

Single request:

```
     $url = 'https://example.com/api/endpoint?api_key=YOUR_API_KEY';
     $fields = null; // if post request, fields is an array with post data else null
     $json_decode = true;
     $rebuild_cache = true; // rebuild cache at the the end of the proccess, more details below
     $response = $cacher->request($url,$fields,$json_decode,$rebuild_cache);
```

Multi Requests:

```
     $url_one = 'https://example.com/api/endpoint?api_key=YOUR_API_KEY';
     $url_two = 'https://example.com/api/endpoint_two?api_key=YOUR_API_KEY';
     $fields = null; // if post request, fields is an array with post data else null
     $json_decode = true;
     $rebuild_cache = true; // rebuild cache at the the end of the proccess, more details below
     $cacher->request_multi($url_one,$fields,$json_decode,$rebuild_cache);
     $cacher->request_multi($url_two,$fields,$json_decode,$rebuild_cache);
     $cacher->execute($json_decode);
     $responses = $cacher->multi_output();

 //Accessing the responses
    $url_one_response = $responses[$url_one];
    $url_two_response = $responses[$url_two];
```

Erase Cache Listener

> To erase all cache files include `eraseCache=true` $\_GET parameter in your request.

> Example:

Enable Auto Refreshing Of Cache Files
=====================================

[](#enable-auto-refreshing-of-cache-files)

Import the resource on your `app/config/routing.yml`

```
_hspace:
   resource: "@HSpaceApiCacherBundle/Resources/config/routing.yml"
```

Call the function at your end of your class/controller

```
        $route = $this->generateUrl('hspace_reload_cache',array(), true); // for controller usage, you have to generate the  url if you are outside of controller
        $cacher->teardown($route);

```

### Version

[](#version)

1.0.0

License
-------

[](#license)

MIT

**Free Software, Hell Yeah!**

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/31916dbf513309cb6fbe0fd4e7bb754ffac7f4e9c6819f2c66dd83d5cb249b44?d=identicon)[nikos\_90](/maintainers/nikos_90)

---

Top Contributors

[![nikos90](https://avatars.githubusercontent.com/u/5305637?v=4)](https://github.com/nikos90 "nikos90 (1 commits)")

### Embed Badge

![Health badge](/badges/h-space-api-cacher-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/h-space-api-cacher-bundle/health.svg)](https://phpackages.com/packages/h-space-api-cacher-bundle)
```

###  Alternatives

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
