PHPackages                             thephpguys/light-crud-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. [Framework](/categories/framework)
4. /
5. thephpguys/light-crud-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

thephpguys/light-crud-bundle
============================

Create a simple crud for your entities

03PHP

Since Sep 22Pushed 5y ago2 watchersCompare

[ Source](https://github.com/ThePHPGuys/LightCrudBundle)[ Packagist](https://packagist.org/packages/thephpguys/light-crud-bundle)[ RSS](/packages/thephpguys-light-crud-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require thephpguys/light-crud-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require thephpguys/light-crud-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    TPG\LightCrudBundle\LightCrudBundle::class => ['all' => true],
];
```

Getting started
===============

[](#getting-started)

### Entity

[](#entity)

Define your entity that implements `TPG\LightCrudBundle\JsonBodySerializable` interface:

```
use TPG\LightCrudBundle\JsonBodySerializable;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="posts")
 */
class Post implements JsonBodySerializable
{
    /**
     * @ORM\Id
     * @ORM\Column(type="uuid")
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class="Ramsey\Uuid\Doctrine\UuidGenerator")
     */
    public $id;

    /**
     * @ORM\Column(type="string")
     */
    public $title;

    /**
     * @ORM\Column(type="string")
     */
    public $description;

}
```

### Controller

[](#controller)

Define your controller:

```
namespace App\Controller;

use App\Entity\Post;
use TPG\LightCrudBundle\Annotation\EntityClass;
use TPG\LightCrudBundle\Annotation\EntityView;
use TPG\LightCrudBundle\DataLoader\DataLoader;
use TPG\LightCrudBundle\DataLoader\LoadContext;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

/**
 * Class UserController
 * @package App\Controller
 * @Route("/posts")
 * @EntityClass("App\Entity\Post")
 */
class PostsController
{

    /**
     * @Route("/",methods="POST")
     * @param Request $request
     */
    public function create(Post $post, EntityManagerInterface $em){
        $em->persist($post);
        $em->flush();
        return new Response(204);
    }

    /**
     * @Route("/{id}/",methods="PUT");
     */
    public function update(Post $post, EntityManagerInterface $em)
    {
        $em->flush();
        return new Response(204);
    }
    /**
     * @Route("/{id}/",methods="DELETE");
     */
    public function remove(Post $post, EntityManagerInterface $em)
    {
        $em->remove($post);
        $em->flush();
        return new Response(204);
    }

    /**
     * @Route("/")
     * @EntityView(fields={"title"})
     */
    public function list(LoadContext $context, DataLoader $dataLoader):JsonResponse
    {
        return new JsonResponse($dataLoader->loadCollection($context));
    }

    /**
     * @param string $id
     * @Route("/{id}/");
     * @EntityView(fields={"title","description"})
     */
    public function show(LoadContext $context, DataLoader $dataLoader, string $id):JsonResponse
    {
        return new JsonResponse($dataLoader->loadOne($id,$context));
    }

}

```

`@EntityClass` annotation indicates what entity used for.

`@EntityView` annotation indicates that what fields will be selected and displayed

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

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.

### Community

Maintainers

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

---

Top Contributors

[![misterx](https://avatars.githubusercontent.com/u/216417?v=4)](https://github.com/misterx "misterx (5 commits)")

### Embed Badge

![Health badge](/badges/thephpguys-light-crud-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/thephpguys-light-crud-bundle/health.svg)](https://phpackages.com/packages/thephpguys-light-crud-bundle)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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