PHPackages                             fanatov37/actioneasekit - 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. fanatov37/actioneasekit

ActiveSymfony-bundle

fanatov37/actioneasekit
=======================

ActionEaseKit is a Symfony library designed for rapidly creating actions and providing convenient services for developers

1.1.1(1y ago)015MITPHPPHP ^8.1

Since Feb 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/fanatov37/actioneasekit)[ Packagist](https://packagist.org/packages/fanatov37/actioneasekit)[ RSS](/packages/fanatov37-actioneasekit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (24)Versions (13)Used By (0)

ActionEaseKit Overview
======================

[](#actioneasekit-overview)

**ActionEaseKit** is a Symfony library designed to help developers rapidly create actions and provide convenient services. It simplifies the development process by streamlining action creation and enhancing access to Symfony's functionality.

Key Features
------------

[](#key-features)

1. **Fast action creation:** Simplify the process of creating actions in Symfony with predefined service architecture.
2. **Service integration:** Provides additional services and abstract classes to standardize actions, enhancing code reusability and maintainability.
3. **JSON EntityData support:** Offers tools to easily work with JSON data within database columns, making it convenient to manage complex data structures.

Prerequisites
-------------

[](#prerequisites)

- **Symfony version:** 6.0 or later
- **PHP version:** 8.1 or later

Ensure you have these installed before proceeding with the library setup.

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

[](#installation)

To start using ActionEaseKit, install it via Composer:

```
composer require fanatov37/actioneasekit
```

Usage
=====

[](#usage)

Example of Action
-----------------

[](#example-of-action)

Define your controller that extends the base `AbstractRequestController` provided by the library:

```
use ActionEaseKit\Base\Controller\AbstractRequestController;

class RequestController extends AbstractRequestController
{
    public function __construct(
        RequestActionService $requestActionService
        // add more action services...
    )
    {
        parent::__construct($requestActionService);
    }
}
```

### Adding Route

[](#adding-route)

You need to define a route for the action. Here's an example of how to add a route in your Symfony application:

```
api_request:
    path: /api/request
    controller: App\Controller\RequestController::indexAction
```

or in Controller

```
#[Route('/api/request', name: 'api_request')]
class RequestController extends AbstractRequestController
{}
```

### Example of Action Service

[](#example-of-action-service)

Create a service that extends the `AbstractActionService`. You can define various actions within this service. Use role attributes if needed for specific actions.

```
use ActionEaseKit\Base\Service\AbstractActionService;
use ActionEaseKit\Attributes\RequiresRole;

class RequestService extends AbstractActionService
{
    public function firstAction(array $args): array
    {
        return $args;
    }

    #[RequiresRole(['ROLE_ADMIN', 'ROLE_USER'])]
    public function secondAction(int $id, string $name): array
    {
        return [
            'id' => $id,
            'name' => $name,
            'email' => $this->getUser()->getUserIdentifier(),
            'roles' => $this->getUser()->getRoles()
        ];
    }
}
```

### POST Request Example

[](#post-request-example)

All POST requests will be made to the `/api/request` endpoint, as specified in the route configuration.

When making a request, you need to specify:

1. **service**: The name of the service that you want to call (e.g., `RequestService`).
2. **action**: The specific action within the service that you want to execute (e.g., `firstAction` or `secondAction`).
3. **arguments**: The arguments required for the action, passed as an associative array.

Here’s how you can send a POST request to trigger your actions:

#### First Action:

[](#first-action)

```
{
    "service": "RequestService",
    "action": "firstAction",
    "arguments": [{"id": 1, "name": "myName"}]
}
```

#### Second Action:

[](#second-action)

```
{
    "service": "RequestService",
    "action": "secondAction",
    "arguments": {"id": 1, "name": "myName"}
}
```

Curl Example

```
curl -X POST http://localhost/api/request \
-H "Content-Type: application/json" \
-d '{
    "service": "RequestService",
    "action": "firstAction",
    "arguments": [{"id": 1, "name": "myName"}]
}'

```

Example of Usage: IndicatorEntity (Quick Data Access from JSON Columns)
-----------------------------------------------------------------------

[](#example-of-usage-indicatorentity-quick-data-access-from-json-columns)

This section demonstrates how to quickly access JSON data stored in columns using the `IndicatorEntity`. Let's assume we have an entity `User` that includes two JSON columns: `data` and `activity_log`.

#### Example Entity: User

[](#example-entity-user)

In this example, the `User` entity extends `IndicatorEntity` to leverage quick access to JSON fields, like user profiles or activity logs, using simple getter methods. Trait DataPropertyTrait has default data json column

```
#[ORM\Table(name: 'users')]
class User extends IndicatorEntity implements PasswordAuthenticatedUserInterface, UserInterface
{
    use DataPropertyTrait;

    public const ACTIVITY_LOG_PROPERTY_NAME = 'activityLog';

    // define your json fields
    protected const INDICATOR_DATA = [
        'profile' => [
            "first_name",
            "last_name",
            "bio",
            "date_of_birth",
            "location",
            "interests"
        ],
        'settings' => [
            'notifications' => ['email', 'sms'],
            'privacy' => ['profile_visible', 'last_seen_visible']
        ]
    ];

    protected const INDICATOR_ACTIVITYLOG = [
        "activity",
        "timestamp",
        "ip_address",
        "location",
        "device",
        "browser",
    ];

    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: 'integer')]
    private int $id;

    // define more json fields
    #[ORM\Column(name: "activity_log", type: "json", nullable: true, options: ["jsonb" => true])]
    protected ?array $activityLog = null;
}
```

### JSON Data Structure

[](#json-data-structure)

- **data Column**: Contains user profile and settings.
- **activity\_log Column**: Tracks user activities, such as logins or password changes.

#### Example of `data` Column

[](#example-of-data-column)

```
{
  "profile": {
    "first_name": "Jane",
    "last_name": "Smith",
    "bio": "Passionate about technology and design.",
    "date_of_birth": "1992-05-30",
    "location": "San Francisco, USA",
    "interests": [
      "design",
      "photography",
      "traveling"
    ]
  },
  "settings": {
    "notifications": {
      "email": true,
      "sms": true
    },
    "privacy": {
      "profile_visible": false,
      "last_seen_visible": true
    }
  }
}
```

#### Example of `activity_log` Column

[](#example-of-activity_log-column)

```
{
  "device": "MacBook Pro",
  "browser": "Chrome",
  "activity": "password_change",
  "location": "Tirana, Albania",
  "timestamp": "2024-10-22T16:45:00Z",
  "ip_address": "192.168.1.15"
}
```

### Quick Access to JSON Data

[](#quick-access-to-json-data)

Here’s an example of how to quickly access data from JSON columns using the `getIndicator()` method.

```
    #[RequiresRole(['ROLE_ADMIN'])]
    public function secondAction(int $id, string $name) : array
    {
        /** @var User $user */
        $user = $this->getUser();

        //get from data columns by default. from trait DataPropertyTrait
        $location = $user->getIndicator('profile:location');
        $notifications = $user->getIndicator('settings:notifications');
        $notificationsSMS = $user->getIndicator('settings:notifications:sms');

        // change property for get data from activity_log columns
        $user->setCurrentPropertyName(User::ACTIVITY_LOG_PROPERTY_NAME);
        $activityLogDevice = $user->getIndicator('device');

        return [
            'id' => $id,
            'name' => $name,
            'email' => $this->getUser()->getUserIdentifier(),
            'roles' => $this->getUser()->getRoles(),
            'location' => $location,
            'notification' => $notifications,
            'notification_sms' => $notificationsSMS,
            'device' => $activityLogDevice
        ];
    }
```

### Explanation of the Example:

[](#explanation-of-the-example)

#### Accessing Data from `data` Column:

[](#accessing-data-from-data-column)

- By default, the `getIndicator()` method fetches data from the `data` column.
    - `profile:location` fetches the user's location (e.g., "San Francisco, USA").
    - `settings:notifications:sms` checks whether SMS notifications are enabled.

#### Switching to `activity_log` Column:

[](#switching-to-activity_log-column)

- To access the `activity_log` column, the `setCurrentPropertyName()` method is used to point to `activityLog`.
- The `getIndicator()` method then fetches data such as the device used during the latest activity.

This method greatly simplifies data retrieval from complex JSON columns, allowing quick and flexible access to nested JSON structures.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Recently: every ~64 days

Total

12

Last Release

562d ago

Major Versions

0.3 → 1.0.02024-10-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/94fd61cf87803fe0dcec025072b71e7f0894cb2f6e40e6e39858f789caca6078?d=identicon)[fanatov37](/maintainers/fanatov37)

---

Tags

phpsymfonySymfony Bundleactioneasekitfanatov37symfony action ease kitsymfony ease

### Embed Badge

![Health badge](/badges/fanatov37-actioneasekit/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)

PHPackages © 2026

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