PHPackages                             lit/drivers - 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. [Database &amp; ORM](/categories/database)
4. /
5. lit/drivers

ActiveLibrary[Database &amp; ORM](/categories/database)

lit/drivers
===========

PHP 驱动封装

v0.0.2(6y ago)145PHPPHP &gt;=5.4.0

Since Oct 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ghostong/LitDrivers)[ Packagist](https://packagist.org/packages/lit/drivers)[ RSS](/packages/lit-drivers/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

MySQL, Redis, Memcached 驱动封装. 用于提高易用性.

### MySQL 操作类测试

[](#mysql-操作类测试)

```
require(__DIR__.'/vendor/autoload.php');

use \Lit\Drivers\LiMySQL;

//可连接多个数据库
$mysql = new LiMySQL('192.168.0.230','3306','root','123456','click') ;
$mysql2 = new LiMySQL('192.168.0.244','3306','root','123456','dbname') ;

//获得帮助
$mysql->help();

$mysql->fetchAll ("show variables like '%version%'") ;
$mysql2->fetchAll ("show variables like '%version%'") ;

//从结果集中获取一行
$mysql-> fetchOne ('select * from `user` where `id` = 1') ;

//获取包含结果集中所有行的数组
$mysql-> fetchAll ('select * from `user` limit 10') ;

//根据条件获取一条数据
$mysql->getOne( 'user', 'id = ? and id = ?', 1, 3 ) ;

//根据条件获取多条数据
$mysql->getAll( 'user', '1 limit ?', 4 );

//添加一条数据
$mysql->add ('user', array('user_name'=>'lily', 'age'=>12) ) ;

//删除数据
$mysql->del ( 'user', 'id= ? or id = ?', 12 , 24 );

//更新数据
$mysql->update( 'user', 'user_name=? where id = ?', 'lucy', 12 ) ;

//获取最后的错误信息
$mysql->lastError() ;

//获取最后的SQL语句
$mysql->lastSql() ;

//获取最后的自增ID
$mysql->lastInsertId() ;

//more ...
```

### Redis 操作类测试

[](#redis-操作类测试)

```
require(__DIR__.'/vendor/autoload.php');

use \Lit\Drivers\LiRedis;

//可连接多个Redis
$redis = new LiRedis('192.168.0.231');
$redis2 = new LiRedis('192.168.0.232');

//保存一条数据到Redis
$redis->set('OneOfRedisKey', 'I love Redis', 3600);

//从Redis中获取一条数据
$redis->get ('OneOfRedisKey') ;

$redis->lPush('OneOfList','I love Redis');

$redis->rPop('OneOfList','I love Redis') ;

//more ...
```

### Memcache 部分

[](#memcache-部分)

```
require(__DIR__.'/vendor/autoload.php');

use \Lit\Drivers\LiMemcached;

//可连接多个Memcached 集群
$mem = new LiMemcached('192.168.0.230',11211);
$mem2 = new LiMemcached('192.168.0.231',11211);

//从Memcached中获取一个值
$mem->get('OneOfMemcacheKey');

//保存一条数据到Memcached
$mem->set('OneOfMemcacheKey','30',0);

$mem->fetchAll(['OneOfMemcacheKey','OneOfMemcacheKey1']) ;

//more ...
```

### 附录

[](#附录)

Ubuntu安装memcached依赖

```
apt-get install -y zlib1g-dev libmemcached11 libmemcached-dev libmemcachedutil2
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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.

###  Release Activity

Cadence

Every ~144 days

Total

2

Last Release

2261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/46be0247284f1f1256accab2ccdb4900e568f6df746a9dc96bf7d6fdfd614d0d?d=identicon)[litong](/maintainers/litong)

---

Top Contributors

[![ghostong](https://avatars.githubusercontent.com/u/5644948?v=4)](https://github.com/ghostong "ghostong (49 commits)")

---

Tags

mysqlredismemcachedrivers

### Embed Badge

![Health badge](/badges/lit-drivers/health.svg)

```
[![Health](https://phpackages.com/badges/lit-drivers/health.svg)](https://phpackages.com/packages/lit-drivers)
```

###  Alternatives

[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.0M130](/packages/phpfastcache-phpfastcache)[malkusch/lock

Mutex library for exclusive code execution.

9459.6M27](/packages/malkusch-lock)[arvenil/ninja-mutex

Simple to use mutex implementation that can use flock, memcache, memcached, mysql or redis for locking

1873.7M27](/packages/arvenil-ninja-mutex)[desarrolla2/cache

Provides an cache interface for several adapters Apc, Apcu, File, Mongo, Memcache, Memcached, Mysql, Mongo, Redis is supported.

1322.5M47](/packages/desarrolla2-cache)[apix/cache

A thin PSR-6 cache wrapper with a generic interface to various caching backends emphasising cache taggging and indexing to Redis, Memcached, PDO/SQL, APC and other adapters.

114542.8k6](/packages/apix-cache)[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3212.5M32](/packages/matthiasmullie-scrapbook)

PHPackages © 2026

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