PHPackages                             hexastudio/array\_disk - 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. hexastudio/array\_disk

ActiveLibrary[Caching](/categories/caching)

hexastudio/array\_disk
======================

Store array as cache in hardDrive, decrease memory usage

v0.8.0(11y ago)21.3k1[10 issues](https://github.com/octa7th/array-disk/issues)MITPHPPHP &gt;=5.1.0

Since Mar 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/octa7th/array-disk)[ Packagist](https://packagist.org/packages/hexastudio/array_disk)[ RSS](/packages/hexastudio-array-disk/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (15)Used By (0)

[![Build Status](https://camo.githubusercontent.com/904f1f280a30b9eb8955275bbd99bf487f6cb857a7e26b5c1bb5ef8410b074b3/68747470733a2f2f7472617669732d63692e6f72672f6f6374613774682f61727261792d6469736b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/octa7th/array-disk)

Array Disk
==========

[](#array-disk)

Store your array in temporary file to decrease memory usage when having a very very big array.

Requirement
-----------

[](#requirement)

- PHP &gt;= 5.1.0

Features
--------

[](#features)

- Create array\_disk using existing array
- Fetch array\_disk line by line
- Fetch value using array\_disk's key
- Append new value to array\_disk

How to use
----------

[](#how-to-use)

```
require 'Array_Disk.php';

// Create new array disk object
$ard = new Array_Disk();

$data = array( 'Value 0', 'Value 1', 'Value 2' );

$ard->store($data); // Store a whole array in array disk object

$ard->length(); // Get current array length (return 3)

$ard->append('Value 3'); // Append value to array disk object

$ard->push('Value 4'); // Alias of append

$ard->length(); // return 5

$ard->pop(); // Remove last element from array disk object and return the last element (return 'Value 4')

$ard->get(1); // Get array value in key 1 (return 'Value 1')

$ard->merge(array('Value 5', 'Value 6')); // Merge array disk object with another array

$ard->length(); // return 6

$ard->slice(2, 3); // return array('Value 2', 'Value 3', 'Value 4')

$filename = $ard->get_filename(); // Get filename of array disk object storage

$ard->read(); // Read array value from the first line (return 'Value 0')
$ard->read(); // return 'Value 1'
$ard->read(); // return 'Value 2'
$ard->read(); // return 'Value 3'
$ard->read(); // return 'Value 5'
$ard->read(); // return 'Value 6'

$ard->rewind(); // Reset cursor back to the first line

$ard->sort(); // Sort data
```

Changelog
---------

[](#changelog)

- 0.1.0 :
    - Original Class
- 0.1.1 :
    - Create new method to get line number of particular file
    - If filename is defined in construct parameter, then use that file's line number as array length
- 0.1.2 :
    - Fix bugs #1
- 0.2.0 :
    - Create new method push (alias of append)
    - Create new method pop
- 0.3.0 :
    - Create new method rewind
    - Create new method merge
- 0.4.0 :
    - Create new method save
- 0.4.1 :
    - Change \\n to PHP\_EOL
- 0.4.2 :
    - Support multiple array in merge method
- 0.5.0 :
    - Create new method fetch\_all
- 0.5.1 :
    - Fix bugs total is NULL
- 0.5.2 :
    - Fix bugs data loss if file is not empty
- 0.6.0 :
    - Create new method sort
- 0.7.0 :
    - Create new method slice
- 0.7.1 :
    - Fix preg\_replace issue
- 0.8.0 :
    - New method concat
- 0.9.0 :
    - Add new option to use php serialize instead of json
    - Optimize code

License
-------

[](#license)

### The MIT License (MIT)

[](#the-mit-license-mit)

Copyright (c) 2014 - 2015, Muhammad Sofyan &lt;&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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 ~27 days

Recently: every ~80 days

Total

13

Last Release

4123d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d338e89c241593d78c64e6e234d0c7eabb34b5a3fb41238dc9182cb22b596f82?d=identicon)[sofyan](/maintainers/sofyan)

---

Top Contributors

[![octa7th](https://avatars.githubusercontent.com/u/2761140?v=4)](https://github.com/octa7th "octa7th (52 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hexastudio-array-disk/health.svg)

```
[![Health](https://phpackages.com/badges/hexastudio-array-disk/health.svg)](https://phpackages.com/packages/hexastudio-array-disk)
```

###  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)
