PHPackages                             infusionweb/laravel-remote-content-cache - 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. infusionweb/laravel-remote-content-cache

ActiveLibrary[Caching](/categories/caching)

infusionweb/laravel-remote-content-cache
========================================

Provides a Laravel caching package for content retrieved from remote server(s).

1.3.1(3y ago)013.7k1MITPHPPHP &gt;=5.5.9

Since Jul 10Pushed 3y ago3 watchersCompare

[ Source](https://github.com/InfusionWeb/laravel-remote-content-cache)[ Packagist](https://packagist.org/packages/infusionweb/laravel-remote-content-cache)[ Docs](https://github.com/infusionweb/laravel-remote-content-cache)[ RSS](/packages/infusionweb-laravel-remote-content-cache/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (4)Versions (18)Used By (0)

Laravel Remote Content Cache
============================

[](#laravel-remote-content-cache)

[![Latest Stable Version](https://camo.githubusercontent.com/1d5010458dfea1d7055d7d3582fb1ccd02ead6e2de4f41c61867d2022e08bd1e/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e7765622f6c61726176656c2d72656d6f74652d636f6e74656e742d63616368652f762f737461626c65)](https://packagist.org/packages/infusionweb/laravel-remote-content-cache) [![Total Downloads](https://camo.githubusercontent.com/331913654564b38af79046af091f3fd35b9db8153b666b6460d6c1a61b222326/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e7765622f6c61726176656c2d72656d6f74652d636f6e74656e742d63616368652f646f776e6c6f616473)](https://packagist.org/packages/infusionweb/laravel-remote-content-cache) [![Latest Unstable Version](https://camo.githubusercontent.com/6cca86cfb3123f6eaf2251bfc807c00cffd9d5111681028815e24d7bbd32dd08/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e7765622f6c61726176656c2d72656d6f74652d636f6e74656e742d63616368652f762f756e737461626c65)](https://packagist.org/packages/infusionweb/laravel-remote-content-cache) [![License](https://camo.githubusercontent.com/d0e5ef7c68ff0c4f4faa69a231fadb3da48d6e4a55e19266d82877d5bb083f9e/68747470733a2f2f706f7365722e707567782e6f72672f696e667573696f6e7765622f6c61726176656c2d72656d6f74652d636f6e74656e742d63616368652f6c6963656e7365)](https://packagist.org/packages/infusionweb/laravel-remote-content-cache)

A Laravel package for retrieving and caching content from remote servers.
-------------------------------------------------------------------------

[](#a-laravel-package-for-retrieving-and-caching-content-from-remote-servers)

This package provides a convenient way to retrieve content from remote servers and cache it for use in Laravel.

The assumption is that this process will be used to create a Laravel front-end for a headless CMS setup. However, there are certainly other use cases for which it should work equally well.

Configuration is handled entirely by a single Laravel config file.

Installation
------------

[](#installation)

### Step 1: Composer

[](#step-1-composer)

Via Composer command line:

```
$ composer require infusionweb/laravel-remote-content-cache
```

Or add the package to your `composer.json`:

```
{
    "require": {
        "infusionweb/laravel-remote-content-cache": "~1.3.1"
    }
}
```

### Step 2: Register the Service Provider

[](#step-2-register-the-service-provider)

Add the service provider to your `config/app.php`:

```
'providers' => [
    //
    Kozz\Laravel\Providers\Guzzle::class,
    InfusionWeb\Laravel\ContentCache\ContentCacheServiceProvider::class,
];
```

### Step 3: Enable the Facade

[](#step-3-enable-the-facade)

Add the facade to your `config/app.php`:

```
'aliases' => [
    //
    'Guzzle' => Kozz\Laravel\Facades\Guzzle::class,
    'ContentCache' => InfusionWeb\Laravel\ContentCache\ContentCacheFacade::class,
];
```

### Step 4: Publish the package config file

[](#step-4-publish-the-package-config-file)

```
$ php artisan vendor:publish --provider="InfusionWeb\Laravel\ContentCache\ContentCacheServiceProvider"
```

You may now configure remote API endpoints for consumption and other preferences by editing the `config/contentcache.php` file.

### Step 5: Enable the Artisan Console Command

[](#step-5-enable-the-artisan-console-command)

Add the command to your `app/Console/Kernel.php`:

```
protected $commands = [
    //
    \InfusionWeb\Laravel\ContentCache\ContentCacheCommand::class,
];
```

This enables the console command which can be used to periodically cache the remote content in Laravel:

```
$ php artisan content:cache
```

The previous command will cache all configured content types, whereas the following command will cache only the "podcasts" type (assuming it is defined in `contentcache.php`).

```
$ php artisan content:cache podcasts
```

Usage Example
-------------

[](#usage-example)

Assuming that a content type "podcasts" is defined in the `config/contentcache.php` file:

```
