PHPackages                             b3it/laravel-memcached-plus - 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. b3it/laravel-memcached-plus

AbandonedArchivedLibrary[Caching](/categories/caching)

b3it/laravel-memcached-plus
===========================

Extends the built-in Laravel 5 Cache Memcached driver adding support for persistent connections, SASL and Memcached options.

4.1(8y ago)1556.4k8MITPHPPHP &gt;=5.4.0

Since Mar 4Pushed 8y ago2 watchersCompare

[ Source](https://github.com/b3it/laravel-memcached-plus)[ Packagist](https://packagist.org/packages/b3it/laravel-memcached-plus)[ RSS](/packages/b3it-laravel-memcached-plus/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (17)Used By (0)

laravel-memcached-plus
======================

[](#laravel-memcached-plus)

[![StyleCI](https://camo.githubusercontent.com/6146da465039718fbe02f6562b992d162d66c39023459a020a657c35291bb1a3/68747470733a2f2f7374796c6563692e696f2f7265706f732f33313636323531362f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/31662516)[![Build Status](https://camo.githubusercontent.com/7ebca0dcf7a21145f7fd286da3d97e259213d8eb0c2bf4952dcfd80ce0a19924/68747470733a2f2f7472617669732d63692e6f72672f623369742f6c61726176656c2d6d656d6361636865642d706c75732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/b3it/laravel-memcached-plus)[![Total Downloads](https://camo.githubusercontent.com/821834089cbcd2a072ff56e6190c6bb88e1b78cb206ec129085c5b474309a56b/68747470733a2f2f706f7365722e707567782e6f72672f623369742f6c61726176656c2d6d656d6361636865642d706c75732f646f776e6c6f616473)](https://packagist.org/packages/b3it/laravel-memcached-plus)[![Latest Stable Version](https://camo.githubusercontent.com/79c3f25f6197e42fef01326e2865820cc9885483e1ebf010337df35cc22dbef3/68747470733a2f2f706f7365722e707567782e6f72672f623369742f6c61726176656c2d6d656d6361636865642d706c75732f762f737461626c65)](https://packagist.org/packages/b3it/laravel-memcached-plus)[![Latest Unstable Version](https://camo.githubusercontent.com/000cabcce07257f18decc8d0106fa53e5106d1afe90323f9661494dddc3319fa/68747470733a2f2f706f7365722e707567782e6f72672f623369742f6c61726176656c2d6d656d6361636865642d706c75732f762f756e737461626c652e737667)](https://packagist.org/packages/b3it/laravel-memcached-plus)[![License](https://camo.githubusercontent.com/d41fec7f1ca2e23820b359e55ddcaf449104dccb6a91b521e1eb17f5deeec749/68747470733a2f2f706f7365722e707567782e6f72672f623369742f6c61726176656c2d6d656d6361636865642d706c75732f6c6963656e7365)](https://packagist.org/packages/b3it/laravel-memcached-plus)

Summary
-------

[](#summary)

*This package is useful for Laravel 5.0 - 5.2. From 5.3 onwards two PRs I submitted to `laravel/framework` have been merged, therefore the features of this package are available out-the-box with Laravel 5.3 onwards.*

Integrating with cloud memcached services such as [MemCachier](https://www.memcachier.com/) and [memcached cloud](https://redislabs.com/memcached-cloud) can require memcached features not available with the built-in [Laravel Cache](http://laravel.com/docs/5.2/cache) memcached driver from version 5.0 to 5.2.

These include:

- SASL authentication
- custom options
- persistent connections

Adding 3 new configuration items, this package *enhances* the built-in Laravel 5 Cache memcached driver. Optionally, this package also allows these extra configuration items to be used for memcached Sessions.

Read on for detailed instructions - you may find it useful to reference the [demo app](https://github.com/b3it/laravel-memcached-plus-demo) at the same time.

Requirements
------------

[](#requirements)

- > = PHP 5.4 with [ext-memcached](http://php.net/manual/en/book.memcached.php)
- To use [SASL](http://docs.php.net/manual/en/memcached.setsaslauthdata.php) it must be compiled with SASL support. This is the default on [Heroku](https://devcenter.heroku.com/articles/php-support)

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

[](#installation)

Available to install as a Composer package on [Packagist](https://packagist.org/packages/b3it/laravel-memcached-plus), all you need to do is:

`composer require b3it/laravel-memcached-plus`

If your local environment does not meet the requirements you may need to append the `ignore-platform-reqs` option:

`composer require b3it/laravel-memcached-plus --ignore-platform-reqs`

Configuration
-------------

[](#configuration)

Once installed you can use this package to enhance the Laravel [Cache](http://laravel.com/docs/5.0/cache) and [Session](http://laravel.com/docs/5.0/session)services.

### Providers

[](#providers)

This section discusses the Laravel application configuration file `app/config.php`.

In the `providers` array you need to replace following built-in Service Providers:

- `Illuminate\Cache\CacheServiceProvider` and
- `Illuminate\Session\SessionServiceProvider` (optional)

A recommended approach is to comment out the built-in providers and append the Service Providers from this package:

```
'providers' => [
    ...
    //'Illuminate\Cache\CacheServiceProvider',
    ...
    //'Illuminate\Session\SessionServiceProvider',
    ...

    /*
     * Application Service Providers...
     */
     ...

    'B3IT\MemcachedPlus\CacheServiceProvider',
    'B3IT\MemcachedPlus\SessionServiceProvider', // optional
],

```

The `B3IT\MemcachedPlus\SessionServiceProvider` is optional. You only need to add this if:

- You want to specify a non-default memcached store to use for sessions, default is "memcached", or
- You want to use the memcached features provided by this package for sessions

### Cache

[](#cache)

This section discusses the Laravel cache configuration file `config/cache.php`.

This package makes the following extra configuration items available for use with a memcached store:

- `persistent_id` - \[`Memcached::__construct`\] () explains how this is used
- `sasl` - used by [`Memcached::setSaslAuthData`](http://php.net/manual/en/memcached.setsaslauthdata.php)
- `options` - see [`Memcached::setOptions`](http://php.net/manual/en/memcached.setoptions.php)

These may be used in a store config like so:

```
'stores' => [
    'memcachedstorefoo' => [
        'driver'  => 'memcached',
        'persistent_id' => 'laravel',
        'sasl'       => [
            env('MEMCACHIER_USERNAME'),
            env('MEMCACHIER_PASSWORD')
        ],
        'options'    => [
            Memcached::OPT_NO_BLOCK         => true,
            Memcached::OPT_AUTO_EJECT_HOSTS => true,
            Memcached::OPT_CONNECT_TIMEOUT  => 2000,
            Memcached::OPT_POLL_TIMEOUT     => 2000,
            Memcached::OPT_RETRY_TIMEOUT    => 2,
        ],
        'servers' => [
            [
                'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100
            ],
        ],
    ],
],

```

Note that as this package *enhances* the built-in Laravel 5 memcached Cache driver, the driver string remains `memcached`.

In case you are unfamiliar with how to use multiple cache stores in Laravel, you would access this store from your application code like so:

```
$value = Cache::store('memcachedstorefoo')->get('key');

```

### Session

[](#session)

This section discusses the Laravel session configuration file `config/session.php`.

If you are using memcached sessions you will have set the `driver` configuration item to 'memcached'.

If you have added the `B3IT\MemcachedPlus\SessionServiceProvider` as discussed above, the `store` configuration item is available. This is explained in the following new snippet you can paste into your session configuration file:

```
    /*
    |--------------------------------------------------------------------------
    | Session Cache Store
    |--------------------------------------------------------------------------
    |
    | When using the "apc" or "memcached" session drivers, you may specify a
    | cache store that should be used for these sessions. This value must
    | correspond with one of the application's configured cache stores.
    |
    */

    'store' => null,

```

To use the previous memcached 'plus' store example with sessions you would set this as follows:

```
    'store' => 'memcachedstorefoo',

```

Breaking changes between v3 and v4
----------------------------------

[](#breaking-changes-between-v3-and-v4)

The configuration of Memcached options has been updated to use the Memcached constants rather than the string constant name.

The `session.memcached_store` variable has been renamed to `session.store`.

laravel-memcached-plus in action
--------------------------------

[](#laravel-memcached-plus-in-action)

I created a [demo app](https://github.com/b3it/laravel-memcached-plus-demo) for you to see how this package integrates with Laravel 5 and how you could run it on Heroku.

Support
-------

[](#support)

Please do let me know if you have any comments or queries.

Thanks!

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~58 days

Recently: every ~124 days

Total

15

Last Release

3266d ago

Major Versions

1.0.1 → 2.0.02015-03-05

2.1.5 → 3.02016-01-18

3.0.3 → 4.02016-05-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/635128b59565facf73f9d3058409cb9c4a1bcf64aacf18214ae8350fa76c47bb?d=identicon)[tomcastleman](/maintainers/tomcastleman)

---

Top Contributors

[![tomcastleman](https://avatars.githubusercontent.com/u/1532660?v=4)](https://github.com/tomcastleman "tomcastleman (104 commits)")

---

Tags

laravellaravel-5-packagelaravel-cachelaravel-memcachedmemcachedmemcached-featuresmemcached-sessionspersistent-connectionsphpsasllaraveloptionscachememcachedherokupersistentsaslmemcachiermemcachedcloud

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/b3it-laravel-memcached-plus/health.svg)

```
[![Health](https://phpackages.com/badges/b3it-laravel-memcached-plus/health.svg)](https://phpackages.com/packages/b3it-laravel-memcached-plus)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[omaralalwi/lexi-translate

Laravel translation package with morph relationships and caching.

754.3k2](/packages/omaralalwi-lexi-translate)[karriere/state

Laravel package for storing current application state in cache/session

1718.5k](/packages/karriere-state)

PHPackages © 2026

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