PHPackages                             adadgio/rocket-bundle - 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. adadgio/rocket-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

adadgio/rocket-bundle
=====================

A lot of cool utilities, helpers and connectors

1.3(7y ago)122MITPHPPHP &gt;=5.3

Since Jun 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/adadgio/AdadgioRocketBundle)[ Packagist](https://packagist.org/packages/adadgio/rocket-bundle)[ RSS](/packages/adadgio-rocket-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

AdadgioGearBundle
=================

[](#adadgiogearbundle)

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

[](#installation)

Install with composer.

```
composer require adadgio/gear-bundle
```

Add the bundle to your app kernel.

```
new Adadgio\GearBundle\AdadgioGearBundle();
```

Table of contents
-----------------

[](#table-of-contents)

1. [Api annotations and auth](#api)
2. [Configuration](#api-configuration)
3. [Annotation usage](#api-annotation)
4. [NodeRed connector(s) and loops](#nodered)
5. [Configuration](#nodered-configuration)
6. [Usage](#nodered-usage)
7. [CSV exporter](#csv-exporter)
8. [CSV reader](#csv-reader)
9. [Entity hydration from data](#entity-hydration)
10. [Serializer](#serializer)
11. \[Others\]

Api annotations and auth
-------------------------------------------------------

[](#api-annotations-and-auth)

Its very easy to create API endpoints and secure them through any kind of authentication system.

### Configuration

[](#configuration)

```
# in config.yml (basic auth example)
adadgio_gear:
    auth:
        type: Basic     # options: Basic (more default types not available in current version)
        class: ~        # either define "class" or "provider", ex. "Adadgio\GearBundle\Component\Api\Authenticatir\AuthProvider"
        #provider: ~    # either define "class" or "provider", ex. "adadgio_gear.api.authenticator_example_service"
        user: benny
        password: test

# in config.yml (custom service auth example, like API client in database)
adadgio_gear:
    auth:
        #type: ~
        #class: ~       # either define "class" or "provider", ex. "Adadgio\GearBundle\Component\Api\Authenticatir\AuthProvider"
        provider: my_bundle.api.my_client_auth  # you create the service and define what to do: see "adadgio_gear.api.authenticator_example_service"
```

### Annotation usage

[](#annotation-usage)

```
use Adadgio\GearBundle\Component\Api\ApiRequest;
use Adadgio\GearBundle\Component\Api\ApiResponse;
use Adadgio\GearBundle\Component\Api\Annotation\Api;

/**
 * @Route("/test/gear/api", name="test_gear_api")
 * @Api(method={"POST","GET"}, enabled=true)
 */
public function myApiEndpointAction(Request $request, ApiRequest $apiRequest)
{
    return new ApiResponse(array('yes' => 'sir'));
}
```

Example using custom authenticator service.

```
use Adadgio\GearBundle\Component\Api\Authenticator\AuthProvider;
use Adadgio\GearBundle\Component\Api\Authenticator\AuthProviderInterface;

class ExampleAuthProviderService extends AuthProvider implements AuthProviderInterface
{
    /**
     * Build your service like you build services every day!
     */
    public function __construct()
    {
        // inject anything in here, like doctrien.orm.entity_manager, or whatever.
    }

    /**
     * Checks auth. You could get request headers key and check that
     * the secret key and client id are in your database for example...
     *
     * @return boolean
     */
    public function authenticate()
    {
        // your owns logic here
        $request = $this->getRequest();
        $headers = $request->getHeaders();

        return true;
    }
}
```

NodeRed connector(s) and loops
-----------------------------------------------------------------

[](#nodered-connectors-and-loops)

### Configuration

[](#configuration-1)

```
# import routing
_adadgio_gear:
    resource: "@AdadgioGearBundle/Resources/config/routing.yml"
```

```
# in config.yml
adadgio_gear:
    nodered:
        host: 127.0.0.1
        port: 1880          # optional
        protocol: http://   # optional
        http_auth:          # optional (depends on Node Red httpNodeAuth param)
            user: ~ 
            pass: ~
```

Then you need to install the flows in your NodeRed app.

```
$ php app/console adadgio:nodered:install --output=/destination/folder
```

You will need to manually import the flows in your NodeRed app (or use flows directory config in NodeRed settings.js).

[![alt tag](https://raw.githubusercontent.com/adadgio/gear-bundle/master/Resources/help/nodered_flow.png)](https://raw.githubusercontent.com/adadgio/gear-bundle/master/Resources/help/nodered_flow.png)

### Usage

[](#usage)

To trigger a loop (or just a delayed message), you need to create a `\Payload` that node red will send back to the AdagagioGearBundle loop controller (see `routing.yml` for more info). The controller dispatches an event when it receives back the payload. You can **listen to the event** and modify the payload to achieve your goal.

```
use Adadgio\GearBundle\Connector\NodeRed\Payload;

// payload contains 3 initial params you cannot override (pid, kill, iteration)
// and they change automatically during the loop lifecycle
$payload = new Payload();

// add more params
$payload->setParameter('my_name', 'Romain'); // nb: 3 params are here by default

// use the connector to start (trigger) the loop
$this->get('adadgio_gear.nodered.connector')->send('POST', '/adadgio/gear/loop/start', $payload); // @todo pass this more transparently
```

The loop will never stop until you change the payload **kill** property. Now **listen** to the loop callbacks. Nodered will indefinitaly call it unless you `kill` the payload.

```
// in some listener, far, far away, a long long time ago
// the listener must listen to "adadgio_gear.nodered.payload_received"
public function onPayloadReceived(\Adadgio\GearBundle\Connector\NodeRed\Event\PayloadEvent $event)
{
    // you might need the request, who knows
    $request = $event->getRequest();

    $payload = $event->Payload();
    // notice iteration changed to +1, pid always stays the same (unless you trigger another process)
    // otherwise you get back the parameters you defined earlier

    // if you wanna stop the flow
    if ($payload->getIteration() > 3) {
        $payload->kill();
    }

    // process... something, or modify your input params at runtime
    $name = $payload->getParameter('my_name');
    $name = ... // change your name!
    $payload->setParameter('my_name', $name);
}
```

CSV exporter
----------------------------------------------------

[](#csv-exporter)

```
use Adadgio\GearBundle\Component\Reader\CsvExporter;

$exporter = $this->get('adadgio_gear.csv_exporter')
    ->setName("exportFileName")
    ->setColumns(array('label', 'views'))
    ->setData(array(array('one','two'),array('three','for')))
    ->generate();
```

CSV reader
------------------------------------------------

[](#csv-reader)

```
use Adadgio\GearBundle\Component\Reader\CsvReader;

$csv = new CsvReader('data/test.csv');

$data = $csv
    ->setDelimiter(';')
    ->read(5, 15) // reads rows from 5 to 15 included (pass null for no limit and offset)
    ->getData();
```

Entity hydration from data
----------------------------------------------------------------------

[](#entity-hydration-from-data)

```php use Adadgio\\GearBundle\\Component\\Hydration\\EntityHydrator; $hydrator = new EntityHydrator();

// $data = ... data from the previous example $hydrator -&gt;hydrate('Adadgio\\DoctrineDQLBundle\\Entity\\TestEntity') -&gt;with($data) -&gt;map(0, 'id') // map array column index to entity property -&gt;map(1, 'name');

$entities = $hydrator-&gt;getEntities();

```

## Serializer

Transform an object in array. Possibilty to transform one object or a collection of objects.

```php
use Adadgio\GearBundle\Component\Serialization\EntitySerializer;

$entities = $em->getRepository('AppBundle:Product')->findAll();

$serializer = $this->get('adadgio_gear.entity_serializer');
$dataSerialized = $serializer->serialize($entitiesÂ);

```

Others
========================================

[](#others)

Starting NodeRed with custom settings file in dev environment (with Ngrok in this case).

```
# start node red with custom settings and pm2 process manager
pm2 start /usr/local/bin/node-red -- -v --settings=/Library/WebServer/home/symfony/360medical-v3/app/data/nodered/settings.js
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85.1% 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 ~127 days

Recently: every ~211 days

Total

8

Last Release

2745d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ca29135fe422cb765f6ada15af5398dc28b857de152c07c4650be1e1e662214?d=identicon)[romainbruckert](/maintainers/romainbruckert)

---

Top Contributors

[![adadgio](https://avatars.githubusercontent.com/u/502070?v=4)](https://github.com/adadgio "adadgio (57 commits)")[![tibeoh](https://avatars.githubusercontent.com/u/1993658?v=4)](https://github.com/tibeoh "tibeoh (10 commits)")

### Embed Badge

![Health badge](/badges/adadgio-rocket-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/adadgio-rocket-bundle/health.svg)](https://phpackages.com/packages/adadgio-rocket-bundle)
```

PHPackages © 2026

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