PHPackages                             kenny1911/ajax-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. kenny1911/ajax-bundle

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

kenny1911/ajax-bundle
=====================

Symfony bundle for help creating ajax endpoints

0.1.x-dev(1y ago)01.3k↑66.7%MITPHPPHP 8.1.\* || 8.2.\* || 8.3.\* || 8.4.\*

Since Mar 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Kenny1911/ajax-bundle)[ Packagist](https://packagist.org/packages/kenny1911/ajax-bundle)[ RSS](/packages/kenny1911-ajax-bundle/feed)WikiDiscussions 0.1.x Synced 1mo ago

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

Ajax Bundle
===========

[](#ajax-bundle)

Language: \[ English | [Русский](./README-RU.md) \]

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

[](#description)

`kenny1911/ajax-bundle` is a Symfony bundle that allows controllers marked with the `#[Ajax]` attribute to:

- Return DTOs instead of `Response` objects.
- Automatically convert controller responses to JSON.
- Convert exceptions thrown in the controller to JSON responses.

Together with Symfony [Mapping Request Data](https://symfony.com/blog/new-in-symfony-6-3-mapping-request-data-to-typed-objects), it can be used as a simpler alternative to [FOS REST Bundle](https://github.com/FriendsOfSymfony/FOSRestBundle).

The `symfony/serializer` package is used for serialization. Serialization is performed **only** in JSON format.

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

[](#installation)

```
composer require kenny1911/ajax-bundle
```

Add `Kenny1911\AjaxBundle\AjaxBundle` to `bundles.php`.

Usage
-----

[](#usage)

Simply add the `#[Ajax]` attribute to a controller method, and the returned DTO will automatically be converted to JSON.

### Example Usage

[](#example-usage)

```
use Kenny1911\AjaxBundle\Attribute\Ajax;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

final class PostController
{
    public function __construct(
        private readonly PostRepository $postRepository,
    ) {}

    #[Ajax]
    public function getPost(string $id): Post
    {
        $post = $this->postRepository->find($id) ?? throw new NotFoundHttpException();

        return new Post(
            id: $post->getId(),
            title: $post->getTitle(),
        );
    }
}
```

The client will receive the following JSON response:

```
{
    "id": 1,
    "title": "Post title"
}
```

Compatibility
-------------

[](#compatibility)

- PHP 8.1+
- Symfony 5.4+

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance46

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

413d ago

### Community

Maintainers

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

---

Top Contributors

[![Kenny1911](https://avatars.githubusercontent.com/u/25887351?v=4)](https://github.com/Kenny1911 "Kenny1911 (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kenny1911-ajax-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

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

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[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)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)

PHPackages © 2026

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