Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Simplify Bundle Laravel Package

daemon/simplify-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle via Composer:

    composer require daemon/simplify-bundle
    

    Register the bundle in config/bundles.php:

    return [
        // ...
        Daemon\SimplifyBundle\DaemonSimplifyBundle::class => ['all' => true],
    ];
    
  2. First Use Case: Auto-Generated CRUD

    • Run the generator command to scaffold a CRUD controller and views:
      php bin/console daemon:simplify:generate:crud Entity/YourEntity
      
    • This creates:
      • A controller (YourEntityController.php) with pre-configured CRUD actions.
      • Twig templates for list, create, edit, and show views.
      • Form types optimized for the entity.
  3. Where to Look First

    • Generator Commands: Check bin/console daemon:simplify for available commands.
    • Configuration: Override defaults in config/packages/daemon_simplify.yaml.
    • Templates: Customize base templates in templates/bundles/DaemonSimplify/.

Implementation Patterns

Workflows

  1. Rapid CRUD Development

    • Use the generator to bootstrap a full CRUD interface in minutes:
      php bin/console daemon:simplify:generate:crud Entity/User --with-form
      
    • Extend the generated controller by overriding methods (e.g., configureListFields()).
  2. Form Customization

    • Extend the auto-generated form type:
      namespace App\Form\Extension;
      
      use Daemon\SimplifyBundle\Form\Type\YourEntityType;
      use Symfony\Component\Form\AbstractType;
      use Symfony\Component\Form\FormBuilderInterface;
      
      class YourEntityTypeExtension extends AbstractType {
          public function buildForm(FormBuilderInterface $builder, array $options) {
              $builder->add('customField', TextType::class);
          }
      }
      
    • Register the extension in config/packages/daemon_simplify.yaml:
      daemon_simplify:
          form_extensions:
              App\Form\Extension\YourEntityTypeExtension: ~
      
  3. Dynamic Field Configuration

    • Use annotations or YAML to define fields for list/edit/show views:
      # config/packages/daemon_simplify.yaml
      daemon_simplify:
          entities:
              App\Entity\User:
                  list_fields: [id, email, createdAt]
                  edit_fields: [email, password, roles]
      
  4. Integration with Existing Projects

    • Symfony UX: Pair with Symfony UX for enhanced interactivity (e.g., Turbo links).
    • API Platform: Use the generated CRUD as a foundation for API endpoints.
    • Doctrine: Leverage existing Doctrine entities without modification.
  5. Theming

    • Override Twig templates by copying files from: vendor/daemon/simplify-bundle/templates/ to templates/bundles/DaemonSimplify/.
    • Extend base templates (e.g., crud/list.html.twig) to add global UI elements.

Gotchas and Tips

Pitfalls

  1. Entity Naming Conflicts

    • Avoid naming entities Crud or Simplify to prevent collisions with bundle internals.
    • Fix: Use unique entity names (e.g., AppCrud, CustomSimplify).
  2. Form Type Overrides

    • Extending form types requires proper namespace alignment. Ensure your extension targets the correct generated class.
    • Debug: Run php bin/console debug:form YourEntityType to verify the form class path.
  3. Template Caching

    • Twig templates may not auto-update if cached. Clear the cache after modifications:
      php bin/console cache:clear
      
  4. Doctrine Lifecycle Callbacks

    • The bundle does not handle Doctrine lifecycle callbacks (e.g., prePersist). Add them manually to your entity or controller.
  5. Permission Handling

    • The bundle does not include security checks. Integrate with Symfony’s security component:
      // In YourEntityController.php
      public function edit(Request $request, YourEntity $entity) {
          $this->denyAccessUnlessGranted('EDIT', $entity);
          // ...
      }
      

Tips

  1. Custom Actions

    • Add custom actions by extending the controller:
      public function customAction(YourEntity $entity) {
          return $this->render('bundles/DaemonSimplify/crud/custom.html.twig', [
              'entity' => $entity,
          ]);
      }
      
    • Link to the action in your template:
      {{ path('app_your_entity_custom', {'id': entity.id}) }}
      
  2. Bulk Operations

    • Enable bulk actions in daemon_simplify.yaml:
      daemon_simplify:
          entities:
              App\Entity\User:
                  enable_bulk_actions: true
      
    • Customize bulk actions in the controller’s configureBulkActions() method.
  3. Localization

    • Override translation keys in translations/messages.en.yaml:
      daemon_simplify:
          create: "Create New Record"
          edit: "Edit Record"
      
  4. Performance

    • For large datasets, paginate list views:
      daemon_simplify:
          entities:
              App\Entity\Product:
                  list_pagination: 50
      
  5. Debugging

    • Enable debug mode in daemon_simplify.yaml to log generator actions:
      daemon_simplify:
          debug: true
      
    • Check logs at var/log/dev.log for generator errors.
  6. Extending the Bundle

    • Create custom generators by implementing Daemon\SimplifyBundle\Generator\GeneratorInterface.
    • Register your generator as a service:
      services:
          App\Generator\CustomCrudGenerator:
              tags: [daemon.simplify.generator]
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
anousss007/vigilance
supportpal/eloquent-model
ardenexal/fhir-models
laravel-at/laravel-image-sanitize
romalytar/yammi-audit-log-laravel
ardenexal/fhir-validation
arshaviras/weather-widget
laravel-chronicle/core
sunchayn/nimbus
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon