PHPackages                             peedro07/symfony-api-rest-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. peedro07/symfony-api-rest-bundle

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

peedro07/symfony-api-rest-bundle
================================

This bundle, with Symfony, makes it easier to manage the rendering of your data

1.5.0(1y ago)150MITPHPPHP ^8.2

Since Apr 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Peedro07/PGTRest)[ Packagist](https://packagist.org/packages/peedro07/symfony-api-rest-bundle)[ RSS](/packages/peedro07-symfony-api-rest-bundle/feed)WikiDiscussions main Synced yesterday

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

PGTRest
=======

[](#pgtrest)

Bundle to simplify Symfony API creation
---------------------------------------

[](#bundle-to-simplify-symfony-api-creation)

*Version 2.0. of the bundle works with Symfony 7.x.x*

This bundle streamlines API development using convenient annotations. It requires the extension of `AbstractPGTRest`.

### Getting Started

[](#getting-started)

To begin, extend the bundle in your controller:

```
class UserController extends AbstractPGTRest
```

Ensure the `responseOptionsService` is initialized by invoking the parent constructor:

```
parent::__construct($responseOptionsService);
```

### Example Usage

[](#example-usage)

Utilize the bundle through an illustrative example:

```
//UserEntity
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;

#[Groups(["user:read"])] // Initialize the group for serialization
#[ORM\Column(length: 255)]
private ?string $name = null;
```

```
//UserController
use App\Repository\UserRepository;
use PGTRest\Attribute\ResponseOptions;
use PGTRest\Controller\AbstractPGTRest;
use PGTRest\Service\ResponseOptionsService;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

    public function __construct(ResponseOptionsService $responseOptionsService)
    {
        parent::__construct($responseOptionsService);
    }

    #[Route('/users', name: 'app_users_get', methods: ["GET"])]
    #[ResponseOptions(statusCode: 200, groups: ["user:read"], formatDate: 'Y-m-d']) // Set the response options with the desired status code and serialization group
    public function index(UserRepository $userRepository): Response
    {
        $users = $userRepository->findAll();

        return $this->view($users); //option 1
        //return $this->view(['all_users' => $users]); option 2
    }
```

```
//option 1
{
    "users": [
        {
            "name": "John"
        },
        {
            "name": "Jane"
        }
    ]
}
```

```
//option 2
{
    "all_users": [
        {
            "name": "John"
        },
        {
            "name": "Jane"
        }
    ]
}
```

Note: The view method accepts an array of data and optional parameters for $statusCode and $groups

### Additional Features

[](#additional-features)

When the `formatDate` option is set, the bundle will format the date fields in the response according to the specified format.

```
#[ResponseOptions(statusCode: 200, groups: ["user:read"], formatDate: 'Y-m-d'])
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Every ~15 days

Recently: every ~22 days

Total

7

Last Release

718d ago

Major Versions

1.4.0 → v2.x-dev2024-04-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/64986753?v=4)[Peedro07](/maintainers/Peedro07)[@Peedro07](https://github.com/Peedro07)

---

Top Contributors

[![Peedro07](https://avatars.githubusercontent.com/u/64986753?v=4)](https://github.com/Peedro07 "Peedro07 (6 commits)")

### Embed Badge

![Health badge](/badges/peedro07-symfony-api-rest-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/peedro07-symfony-api-rest-bundle/health.svg)](https://phpackages.com/packages/peedro07-symfony-api-rest-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

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

8.5k5.9M738](/packages/sylius-sylius)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k185.6M2.4k](/packages/symfony-security-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)

PHPackages © 2026

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