PHPackages                             zeecoder/good-to-know - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zeecoder/good-to-know

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zeecoder/good-to-know
=====================

A solution for collecting good-to-know facts to show to users.

v2.0(10y ago)03.4k1[2 issues](https://github.com/ZeeCoder/good-to-know/issues)MITPHPPHP &gt;=5.3

Since May 25Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ZeeCoder/good-to-know)[ Packagist](https://packagist.org/packages/zeecoder/good-to-know)[ RSS](/packages/zeecoder-good-to-know/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

Good To Know v2.0
=================

[](#good-to-know-v20)

[![Build Status](https://camo.githubusercontent.com/3178d3109c5597d4bdd7687585400ff6c8cd5f3a8f5813568aa1f1504f76305a/68747470733a2f2f7472617669732d63692e6f72672f5a6565436f6465722f676f6f642d746f2d6b6e6f772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ZeeCoder/good-to-know)[![Version](https://camo.githubusercontent.com/48de9c129f8e6f22effe92f9884a3f23ddf325a5204749f8e6802cd3b4dad11c/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6565636f6465722f676f6f642d746f2d6b6e6f772e7376673f7374796c653d666c6174)](https://packagist.org/packages/zeecoder/good-to-know)[![SensioLabsInsight](https://camo.githubusercontent.com/15968dcbea3015b8891a208b012e354970dd0594750b1c1c43a49d2cf83de240/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64333561303336332d306264302d346463342d393766342d6535636335653863633930652f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d35a0363-0bd0-4dc4-97f4-e5cc5e8cc90e)

Description
-----------

[](#description)

The original purpose of this project was to have an easy way of collecting good-to-know facts for certain pages / features that need explanation.

To achieve that, the code was engineered in a very generic way:

- Fetch all the data with a repository call,
- Apply transformations on the returned collection and/or it's elements via Listeners.

Since the code uses listeners, it's very easy to add / remove functionality.

### Built-in features

[](#built-in-features)

- Parameter injection
- Translation support

Integrations
------------

[](#integrations)

- [Silex2](docs/silex2.md)
- [Symfony2](docs/symfony2.md)

A simple example
----------------

[](#a-simple-example)

```
# good-to-know.yml
# When loaded and fetched by the `YamlFileRepository`, these will be converted
# into `Fact` objects.
- text: Something important.
  groups: [feature1]
- text: Something important about feature2.
  groups: [feature2]
- text: Something important about both features.
  groups: [feature1, feature2]
```

```
use ZeeCoder\GoodToKnow\GoodToKnow;
use ZeeCoder\GoodToKnow\Repository\YamlFileRepository;

// The `GoodToKnow` object acts as a wrapper around the given repository.
// Every call made to this object is forwarded to the repository.
// The listeners are fired after getting the result collection from the
// repository.
$gtk = new GoodToKnow(
    new YamlFileRepository(__DIR__ . '/good-to-know.yml')
    // A dispatcher could be passed as the second argument.
    // If no dispatcher is given, one gets created
);

// `findAllByGroups` is a method in the `YamlFileRepository` repository.
// It returns a collection of `ZeeCoder\GoodToKnow\Fact` objects.
// (In this case, an `\SplObjectStorage`.)
$collection = $gtk->findAllByGroups([
    'feature1'
]);

// The collection would have the "Something important." and
// "Something important about both features." texts as Fact objects.
```

Listeners
---------

[](#listeners)

Without listeners, the main `GoodToKnow` object doesn't do anything apart from forwarding calls to the repository.

It gets interesting, when you throw some listeners into the mix.

### The `ParameterListener`

[](#the-parameterlistener)

This listener's job is to inject registered parameters into good-to-know strings.

```
# good-to-know.yml
# When loaded and fetched by the `YamlFileRepository`, these will be converted
# into `Fact` objects.
- text: Something important. %lorem%!
  groups: [feature1]
- text: Something important about feature2.
  groups: [feature2]
- text: Something important about both features: The upload max filesize is: %upload_max_filesize%.
  groups: [feature1, feature2]
```

```
// ...
// Assuming the example above

use ZeeCoder\GoodToKnow\ParameterInjector;
use ZeeCoder\GoodToKnow\Events;
use ZeeCoder\GoodToKnow\Listener\ParameterListener;

// Getting the dispatcher, since we didn't provide one explicitly.
$dispatcher = $gtk->getDispatcher();

// Creating the ParameterInjector
$parameterInjector = (new ParameterInjector())
    // Registering parameters
    ->addParameter('%lorem%', 'ipsum')
    ->addParameter('%upload_max_filesize%', function() {
        return ini_get('upload_max_filesize');
    })
;

// Adding the listener.
// The TRANSFORM event is fired for every result returned by the repository.
$dispatcher->addListener(
    Events::TRANSFORM,
    new ParameterListener($parameterInjector)
);

$collection = $gtk->findAllByGroups([
    'feature1'
]);

// Now the collection would have the "Something important. ipsum!" and
// "Something important about both features: The upload max filesize is: 2M."
// texts as Fact objects.
```

### The `TranslationListener`

[](#the-translationlistener)

This listener assumes a translator implementing Symfony's `TranslatorInterface`.

```
use ZeeCoder\GoodToKnow\Events;
use ZeeCoder\GoodToKnow\Listener\TranslationListener;

// Getting the dispatcher, since we didn't provide one explicitly.
$dispatcher = $gtk->getDispatcher();

$dispatcher->addListener(
    Events::TRANSFORM,
    new TranslationListener(
        // Assuming we have a Symfony `$translator` object.
        $translator
        // The second parameter, is the translation domain. Default: "good-to-know"
    )
);

// Now all Fact texts will be translated.
```

**Important**

The `TranslationListener` must be registered first, or with a higher priority than the `ParameterListener`.

That way parameters can be injected after translations occured.

Source
------

[](#source)

Consider looking at the source files, in order to enhance / alter basic functionality.

(Creating a Database Repository for example.)

- [Events](src/ZeeCoder/GoodToKnow/Events.php)
- [Repositories](src/ZeeCoder/GoodToKnow/Repository)
- [The Fact Object](src/ZeeCoder/GoodToKnow/Fact.php)

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

3809d ago

Major Versions

v1.1.1 → v2.02015-12-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e687a6f6716c6e83e177cff410556da517e19ec5a16674c9389577ca22cfbc6?d=identicon)[ZeeCoder](/maintainers/ZeeCoder)

---

Top Contributors

[![ZeeCoder](https://avatars.githubusercontent.com/u/3679506?v=4)](https://github.com/ZeeCoder "ZeeCoder (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zeecoder-good-to-know/health.svg)

```
[![Health](https://phpackages.com/badges/zeecoder-good-to-know/health.svg)](https://phpackages.com/packages/zeecoder-good-to-know)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[mapbender/mapbender

Mapbender library

10117.4k5](/packages/mapbender-mapbender)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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