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.6k—7.8%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 today

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 57% of packages

Maintenance42

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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

460d 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

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[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)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M576](/packages/shopware-core)[open-dxp/opendxp

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

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

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

6942.5M420](/packages/drupal-core-recommended)

PHPackages © 2026

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