PHPackages                             carlosv2/pocket - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. carlosv2/pocket

ActiveLibrary[Testing &amp; Quality](/categories/testing)

carlosv2/pocket
===============

Little storing services

1.0.0(9y ago)01261MITPHPPHP &gt;=5.5

Since Nov 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/carlosV2/Pocket)[ Packagist](https://packagist.org/packages/carlosv2/pocket)[ RSS](/packages/carlosv2-pocket/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Pocket
======

[](#pocket)

Little storing services

[![License](https://camo.githubusercontent.com/d6f99eb25a3aa39b55c752e217d7b995b8ab394b78962a4929d5d03c7d1ba694/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7376322f706f636b65742f6c6963656e7365)](https://packagist.org/packages/carlosv2/pocket)[![Build Status](https://camo.githubusercontent.com/e2bd44294e2fe4417af93926dd1195bb297e44cf5cfc42371dd61157010166b4/68747470733a2f2f7472617669732d63692e6f72672f6361726c6f7356322f506f636b65742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/carlosV2/Pocket)[![SensioLabsInsight](https://camo.githubusercontent.com/fce53a773cbc359762d1b1c67f5ced6e4d3efb826373de815b903172781977df/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63633739333433632d353665642d346464372d393332612d3165643439343037323161342f6d696e692e706e67)](https://insight.sensiolabs.com/projects/cc79343c-56ed-4dd7-932a-1ed4940721a4)

This project aims to provide quick and easy in-file persisting capabilities.

Usage
-----

[](#usage)

The projec is composed by 3 main classes:

- `ValuePocket`: This class stores just a single value of any type. It requires the path of the file where the data will be persisted. Optionally, you can pass a default value that will be returned if nothing has been stored yet. For example:

    ```
    use carlosV2\Pocket\ValuePocket;

    $pocket = new ValuePocket('/path/to/the/file', 42);
    $pocket->load(); // Returns: 42

    $pocket->save(4);
    $pocket->load(); // Returns: 4
    ```
- `CollectionPocket`: This class stores a collection of values of any type. It requries the path of the file where the data will be persisted. For example:

    ```
    use carlosV2\Pocket\CollectionPocket;

    $pocket = new CollectionPocket('/path/to/the/file');
    $pocket->add('a');
    $pocket->add(1);
    $pocket->add(true);

    $pocket->getValues(); // Returns: ['a', 1, true]
    ```
- `IndexedPocket`: This class stores an indexed collection of values of any type. It requires the path of the file where the data will be persisted. For example:

    ```
    use carlosV2\Pocket\IndexedPocket;

    $pocket = new IndexedPocket('/path/to/the/file');
    $pocket->add('key1', 'a');
    $pocket->add('key2', 1);
    $pocket->add('key3', true);

    $pocket->getValues(); // Returns: ['a', 1, true]
    $pocket->getKeys(); // Returns: ['key1', 'key2', 'key3']
    ```

Additionally, a manager class is provided so that a single folder path is needed. The files management is carried out by this class. Additionally, it can perform maintenance task. For example:

```
use carlosV2\Pocket\PocketManager;

$manager = new PocketManager('/path/to/the/folder/');

$manager->getValuePocket(); // Returns an instance of ValuePocket
$manager->getCollectionPocket(); // Returns an instance of CollectionPocket
$manager->getIndexedPocket(); // Returns an instance of IndexedPocket

$manager->clear(); // Removes any file inside /path/to/the/folder/ folder
```

Install
-------

[](#install)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this project:

```
$ composer require --dev carlosv2/pocket
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3512d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2642839?v=4)[Carlos Ortega](/maintainers/carlosV2)[@carlosV2](https://github.com/carlosV2)

---

Top Contributors

[![carlosV2](https://avatars.githubusercontent.com/u/2642839?v=4)](https://github.com/carlosV2 "carlosV2 (11 commits)")

---

Tags

symfonyfilesystemteststoring

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carlosv2-pocket/health.svg)

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

###  Alternatives

[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

79513.1M132](/packages/zenstruck-foundry)[certificationy/certificationy

A library to create certification system

46731.4k1](/packages/certificationy-certificationy)[certificationy/symfony-pack

A series of questions to prepare for the certification Symfony2

33428.8k1](/packages/certificationy-symfony-pack)[zenstruck/console-test

Alternative, opinionated helper for testing Symfony console commands.

57703.7k29](/packages/zenstruck-console-test)[robertfausk/behat-panther-extension

Symfony Panther extension for Behat

341.9M106](/packages/robertfausk-behat-panther-extension)[zenstruck/mailer-test

Alternative, opinionated helpers for testing emails sent with symfony/mailer.

45719.0k6](/packages/zenstruck-mailer-test)

PHPackages © 2026

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