gales/maker-bundle

Generador de ABMs basado en Petkopara Crud Generator reutilizando cรณdigo del Maker Bundle de Symfony

Installs: 381

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 2

Open Issues: 0

Type:symfony-bundle

v1.0.0 2025-09-12 13:41 UTC

README

A powerful Symfony CRUD generator bundle with pagination, filtering, Bootstrap v5.2 markup and many advanced features. It's simple to use and fully customizable.

Designed to bring back the functionality of PetkoparaCrudGeneratorBundle, but reusing the logic from Symfony's Maker Bundle.

๐Ÿ“‹ Requirements

  • PHP: 8.1+
  • Symfony: 4.4, 5.4, 6.3, 7.0+
  • Doctrine ORM: 2.5+ or 3.0+

๐Ÿ“ฆ Installation

Add the Bundle with composer:

composer require gales/maker-bundle:^0.1

Configure Twig to use Bootstrap 5 Form Theme:

# config/packages/twig.yaml
twig:
    form_themes: ['bootstrap_5_layout.html.twig']

โšก Usage

Run the command:

php bin/console gales:make:crud

Using parameters:

php bin/console gales:make:crud <EntityClassName> [filter-type] [base-template]

Example:

php bin/console gales:make:crud Product input base.html.twig

๐Ÿ“ Generated Files

After selecting the Entity for which to generate the CRUD, the following files are created:

created: src/Service/<entity_name>CrudService.php          (Auxiliary logic for CRUD functionality)
created: src/Controller/<entity_name>Controller.php        (Controller with CRUD logic)
created: src/Form/<entity_name>Type.php                    (Form for entity creation/editing)
created: src/Form/<entity_name>(Full)FilterType.php        (Listing filter)
created: templates/<entity_name>/edit.html.twig            (Entity editing view)
created: templates/<entity_name>/index.html.twig           (Entity listing view)
created: templates/<entity_name>/new.html.twig             (New entity creation view)
created: templates/<entity_name>/show.html.twig            (Entity data visualization view)

๐ŸŽฏ Features

  • โœ… Full CRUD Operations (Create, Read, Update, Delete)
  • โœ… Pagination with configurable page size
  • โœ… Advanced Filtering (input, select, date filters)
  • โœ… Bootstrap 5.2 responsive design
  • โœ… Multi-column Sorting with custom ordering
  • โœ… Form Validation with Symfony constraints
  • โœ… Service Layer for business logic separation
  • โœ… Twig Templates with inheritance support
  • โœ… Symfony 7 compatible

๐Ÿš€ Development and Local Testing Setup

Clone the bundle repository outside your project, for example from your project root:

mkdir ../00_Bundles
cd ../00_Bundles
git clone https://github.com/GALes/maker-bundle.git

Add the following repositories to your project's composer.json:

{
    "repositories":[
        {
            "type": "path",
            "url": "../00_Bundles/maker-bundle",
            "options": {
                "symlink": true
            }
        }
    ],
    "minimum-stability": "dev",
    "prefer-stable": true
}

Install the bundle with composer:

composer require gales/maker-bundle:*

Then run:

composer dump-autoload

๐Ÿท๏ธ Custom Ordering for Related Entities (Deprecated)

To define the field to be used for sorting a column associated with a related entity, you can use PHP 8 attributes (recommended) or annotations (deprecated).

Using PHP 8 Attributes (Recommended)

// src/Entity/Solicitud.php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;

class SolicitudBanco
{
    #[ORM\ManyToOne(targetEntity: SolicitudEstado::class)]
    #[ORM\JoinColumn(nullable: false)]
    private SolicitudEstado $estado;
}
// src/Entity/SolicitudEstado.php
namespace App\Entity;
use GALes\MakerBundle\Attribute as GalesMaker;

#[GalesMaker\OrderBy('descripcion')]
class SolicitudEstado
{
    private string $descripcion;
}

Using Annotations (Deprecated)

For backward compatibility, the old annotation syntax is still supported:

// src/Entity/SolicitudEstado.php
namespace App\Entity;

/**
 * @GalesMaker(orderBy="descripcion")
 */
class SolicitudEstado
{
    private $descripcion;
}

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.