PHPackages                             check24/apitk-manipulation-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. [API Development](/categories/api)
4. /
5. check24/apitk-manipulation-bundle

ActiveSymfony-bundle[API Development](/categories/api)

check24/apitk-manipulation-bundle
=================================

3.0.1(4y ago)13.7k4[3 PRs](https://github.com/byWulf/apitk-manipulation-bundle/pulls)MITPHPPHP ^7.4 || ^8.0

Since Aug 7Pushed 3y ago3 watchersCompare

[ Source](https://github.com/byWulf/apitk-manipulation-bundle)[ Packagist](https://packagist.org/packages/check24/apitk-manipulation-bundle)[ RSS](/packages/check24-apitk-manipulation-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (19)Versions (21)Used By (0)

apitk-manipulation-bundle
=========================

[](#apitk-manipulation-bundle)

API Toolkit Bundle to handle POST, PUT, PATCH and DELETE methods.

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

[](#installation)

Install the package via composer:

```
composer require check24/apitk-manipulation-bundle
```

Usage
-----

[](#usage)

### Example Classes

[](#example-classes)

See the `example`-Folder in this repository:

##### User entity

[](#user-entity)

```
namespace MyApp\Entity;

use Symfony\Component\Validator\Constraints as Assert;

class User
{
    private $id;

    /**
     * @Assert\NotBlank()
     */
    private $username;

    /**
     * @Assert\NotBlank()
     * @Assert\Email()
     */
    private $email;

    /**
     * @Assert\NotBlank()
     */
    private $fullname;

    // ...
}
```

##### User FormType

[](#user-formtype)

```
namespace MyApp\Form\Type;

use MyApp\Entity\User;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class UserV1Type extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('username', TextType::class)
            ->add('email', EmailType::class)
            ->add('fullname', TextType::class);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(
            [
                'data_class' => User::class,
            ]
        );
    }
}
```

##### Controller

[](#controller)

```
namespace MyApp\Controller;

use FOS\RestBundle\Controller\Annotations as Rest;
use MyApp\Entity\User;
use Shopping\ApiTKManipulationBundle\Annotation as Manipulation;
use Swagger\Annotations as SWG;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

class UserV1Controller extends Controller
{
    /**
     * Create a new user.
     *
     * @Rest\Post("/v1/users/{id}")
     * @Manipulation\Update("user", type=UserV1Type::class)
     *
     * @SWG\Tag(name="User")
     *
     * @param User $user
     *
     * @return Response
     */
    public function postUserV1(User $user): Response
    {
        return new Response('', 200);
    }

    /**
     * Update all properties of a given user.
     *
     * @Rest\Put("/v1/users/{id}")
     * @Manipulation\Update("user", type=UserV1Type::class)
     *
     * @SWG\Tag(name="User")
     *
     * @param User $user
     *
     * @return Response
     */
    public function putUserV1(User $user): Response
    {
        return new Response('', 200);
    }

    /**
     * Partially update a users's properties.
     *
     * @Rest\Patch("/v1/users/{id}")
     * @Manipulation\Update("user", type=UserV1Type::class)
     *
     * @SWG\Tag(name="User")
     *
     * @param User $user
     *
     * @return Response
     */
    public function patchUserV1(User $user): Response
    {
        return new Response('', 200);
    }

    /**
     * Remove a user.
     *
     * @Rest\Delete("/v1/user/{id}")
     *
     * @Manipulation\Delete("id", entity=User::class)
     *
     * @SWG\Tag(name="User")
     *
     * @return Response
     */
    public function deleteUserV1(Response $response): Response
    {
        return $response;
    }
}
```

#### Updating Entities (POST, PUT, PATCH)

[](#updating-entities-post-put-patch)

Updating entites works by mapping request data to a form, validating it and then persisting the form's data to the Database via Doctrine.

You'll need:

- Doctrine Entity
- Form Type with data\_class
- Controller Action

```
use Shopping\ApiTKManipulationBundle\Annotation as Manipulation;

/**
 * Partially update a users's properties.
 *
 * @Rest\Patch("/v1/users/{id}")
 * @Manipulation\Update("user", type=UserV1Type::class)
 *
 * @SWG\Tag(name="User")
 *
 * @param User $user
 *
 * @return Response
 */
public function patchUserV1(User $user): Response
{
    return new Response('', 200);
}
```

This will also auto-generate appropriate Swagger parameters. Usage of FOSRest bundle is optional. Controller methods look the same for POST and PUT.

The `$user` parameter is an already updated version of the requested User. You can do anything you want with it: Serialization, JSON encode, etc.

Internally, the `Update` annotation fetches the `default` EntityManager, gets the Repository and executes `find($id)`on it. You can customize this in three ways:

1. If you'd like to use a **different ORM connection** than `default`, supply it via `entityManager`:

    ```
    @Manipulation\Update("user", type=UserV1Type::class, entityManager="custom")

    ```

    This will cause the annotation to fetch the repository and entity from the "custom" EntityManager.
2. If you'd like to use a **different Repository method** than `find`, use the `methodName` option:

    ```
    @Manipulation\Update("user", type=UserV1Type::class, methodName="findById")

    ```
3. If your **path component is something different** than `id`, eg. `email`, you can supply the parameter to use via the `requestParam` option:

    ```
    @Manipulation\Update("user", type=UserV1Type::class, requestParam="email", methodName="findByEmail")

    ```

#### Removing Entities (DELETE)

[](#removing-entities-delete)

To remove an entity, add an action to your controller that uses the `Delete`-Annotation.

```
use Shopping\ApiTKManipulationBundle\Annotation as Manipulation;

/**
 * Remove a user.
 *
 * @Rest\Delete("/v1/user/{id}")
 *
 * @Manipulation\Delete("id", entity=User::class)
 *
 * @SWG\Tag(name="User")
 *
 * @return Response
 */
public function deleteUserV1(Response $response): Response
{
    return $response;
}
```

`@Manipulation\Delete("id", entity=User::class)`

- `"id"` is the name of the path-component to get the ID from
- `entity=User::class` is the type of the entity to be removed

The `$response` parameter is a HTTP 204-Response (No Content). You can just return it, or ignore it and build one of your own.

`Delete` will, by default, perform a hard delete by executing `find($id)` on `UserRepository` and then removing the Entity via `ObjectManager::remove`.

As with `Update`, you can customize this behaviour:

1. If you'd like to **perform a soft delete or other things** instead, use the `methodName` option:

    ```
    @Manipulation\Delete("id", entity=User::class, methodName="deleteById")

    ```

    This will cause the Annotation to call `DeleteRepository::deleteById(DeletionService $deletionService)`. The `DeletionService` allows you to access all request parameters. Perform anything you want to mark your Entity as deleted, eg. setting a deleted-Property from 0 to 1 and then flushing the EntityManager.
2. If you'd like to use a **different ORM connection** than `default`, supply it via `entityManager`:

    ```
    @Manipulation\Delete("id", entity=User::class, entityManager="custom")

    ```

    This will cause the annotation to operate against the "custom" EntityManager.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 54% 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 ~79 days

Recently: every ~147 days

Total

16

Last Release

1649d ago

Major Versions

0.5.1 → 1.0.02018-08-16

1.0.3 → 2.0.12020-03-23

2.2.0 → 3.0.02021-10-13

PHP version history (3 changes)0.1.0PHP ^7.1.3

2.2.0PHP ^7.1.3 || ^8.0

3.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/82e22e3d09adca0634ae909f6e3a8cbb82e193d6436ca7e304e2ff666097e58a?d=identicon)[ofeige](/maintainers/ofeige)

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

---

Top Contributors

[![alexdo](https://avatars.githubusercontent.com/u/690188?v=4)](https://github.com/alexdo "alexdo (34 commits)")[![byWulf](https://avatars.githubusercontent.com/u/135651?v=4)](https://github.com/byWulf "byWulf (15 commits)")[![markuspoerschke](https://avatars.githubusercontent.com/u/1222377?v=4)](https://github.com/markuspoerschke "markuspoerschke (8 commits)")[![dariotilgner](https://avatars.githubusercontent.com/u/1674931?v=4)](https://github.com/dariotilgner "dariotilgner (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/check24-apitk-manipulation-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/check24-apitk-manipulation-bundle/health.svg)](https://phpackages.com/packages/check24-apitk-manipulation-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M648](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M309](/packages/easycorp-easyadmin-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/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)

PHPackages © 2026

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