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

Admin Bundle Laravel Package

boshurik/admin-bundle

Symfony admin bundle inspired by standard CRUD generators. Install via Composer, register the bundle, and mount routes under /admin. Includes frontend build workflow (npm/bower/gulp); administrator entity and security setup are TBD.

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps (Laravel Context)

Since this is a Symfony-only bundle, direct integration into Laravel is not feasible. However, if you still want to explore its core functionality for inspiration or partial use, follow these theoretical steps:

  1. Understand the Core Concept

    • The bundle auto-generates CRUD interfaces for Doctrine entities (Symfony’s ORM).
    • Key features:
      • List/views for entities (e.g., User, Product).
      • Create/Edit forms with validation.
      • Basic filtering/search.
      • Bootstrap-like UI (Twig templates).
  2. Equivalent Laravel Alternatives

    • Filament: Modern, headless admin panel.
      composer require filament/filament:"^3.0"
      
    • Backpack for Laravel: CRUD generator.
      composer require backpack/crud
      
    • Nova: Official Laravel admin panel (paid).
  3. Quick Laravel CRUD Example (Manual) If you want to replicate the bundle’s functionality in Laravel:

    php artisan make:controller Admin/UserController --resource
    

    Define routes in routes/web.php:

    Route::resource('admin/users', \App\Http\Controllers\Admin\UserController::class);
    

    Use Laravel’s built-in Form Requests for validation:

    php artisan make:request StoreUserRequest
    
  4. Where to Look First

    • Symfony Docs: Study EasyAdmin (a more mature alternative) to understand admin bundle patterns.
    • Laravel Admin Packages: Compare Filament/Backpack features (e.g., Filament Docs).

Implementation Patterns

Symfony Workflows (For Reference)

  1. Entity Setup

    • Define a Doctrine entity (e.g., User):
      // src/Entity/User.php
      namespace App\Entity;
      use Doctrine\ORM\Mapping as ORM;
      
      #[ORM\Entity]
      class User { ... }
      
    • The bundle would auto-generate CRUD for this (but not in Laravel).
  2. Routing

    • Symfony’s routing.yml:
      BoShurikAdminBundle:
          resource: "@BoShurikAdminBundle/Resources/config/routing.yml"
          prefix: /admin
      
    • Laravel equivalent:
      Route::prefix('admin')->group(function () {
          Route::resource('users', UserController::class);
      });
      
  3. Form Types

    • Symfony uses FormType classes (e.g., UserType):
      namespace App\Form;
      use Symfony\Component\Form\AbstractType;
      use Symfony\Component\Form\FormBuilderInterface;
      
      class UserType extends AbstractType {
          public function buildForm(FormBuilderInterface $builder, array $options) {
              $builder->add('name')->add('email');
          }
      }
      
    • Laravel equivalent: Form Requests or Livewire/Inertia components.
  4. Filters

    • Symfony bundles often support filtering via FormType or query builders.
    • Laravel: Use API Resources or Scout for search/filtering.
  5. Security

    • Symfony’s security.yml:
      access_control:
          - { path: ^/admin, roles: ROLE_ADMIN }
      
    • Laravel: Use Gate Policies or Middleware:
      Route::middleware(['auth', 'admin'])->group(function () { ... });
      

Laravel Integration Tips (If Partial Use)

  • Extract UI Logic: Copy Twig templates to Laravel’s Blade (but this is fragile).
  • Use API + Frontend: Build a Laravel API and consume it in a React/Vue admin panel (e.g., React Admin).
  • Livewire/Inertia: For real-time CRUD, use:
    composer require laravel/livewire
    
    Example:
    // app/Http/Livewire/Admin/UserManager.php
    public function render() {
        return view('livewire.admin.user-manager', [
            'users' => User::all(),
        ]);
    }
    

Gotchas and Tips

Pitfalls (Symfony Bundle)

  1. No Laravel Support

    • Error: Attempting to register BoShurikAdminBundle in Laravel’s AppServiceProvider will fail with:
      Class 'BoShurik\AdminBundle\BoShurikAdminBundle' not found in Laravel's autoloader.
      
    • Fix: Abandon this bundle for Laravel; use Filament/Backpack instead.
  2. Documentation Gaps

    • The README mentions TBD for critical steps (e.g., entity setup, security).
    • Workaround: Study EasyAdmin’s docs for similar patterns.
  3. Dependency Conflicts

    • Symfony bundles require:
      • doctrine/orm (vs. Laravel’s Eloquent).
      • symfony/form (vs. Laravel’s Form component).
    • Fix: Avoid installing this bundle in Laravel projects.
  4. UI Limitations

    • Uses Twig (not Blade) and likely Bootstrap 3/4 (outdated).
    • Laravel Alternative: Filament uses Tailwind CSS and supports modern JS frameworks.
  5. Security Risks

    • No clear RBAC or audit logging in the bundle.
    • Laravel Fix: Use Laravel’s Policies, Audit Log Packages (e.g., spatie/laravel-audit-logs), or Nova’s built-in features.

Debugging Tips

  1. Symfony-Specific Errors

    • If you must debug the bundle (e.g., for learning), set up a Symfony project alongside Laravel and test there.
    • Example error:
      Cannot autowire service "BoShurik\AdminBundle\Service\AdminService": No such file or directory.
      
    • Fix: Check the bundle’s composer.json for missing dependencies.
  2. Laravel Workarounds

    • To replicate filtering:
      // Laravel: Filter users by role
      $users = User::where('role', 'admin')->get();
      
    • In Symfony, this would use a Repository or FormType filter.
  3. Performance Quirks

    • Symfony admin bundles often load all entity data in memory (N+1 queries).
    • Laravel Fix: Use with() or load() in Eloquent:
      User::with('posts')->get();
      

Extension Points

  1. Customizing the Bundle (Symfony)

    • Override Twig templates in templates/BoShurikAdminBundle/ (Symfony convention).
    • Extend FormType classes to add fields.
  2. Laravel Equivalents

    • Filament: Extend resources:
      Filament\Resources\UserResource::class,
      
    • Backpack: Customize CRUD fields:
      CRUD::addFields([...]);
      
  3. Adding Features

    • Symfony: Use events (e.g., admin.pre_save).
    • Laravel: Use Observers, Events, or Service Providers.

When It Might Be Useful

  • Learning Symfony: Study the bundle’s architecture to understand Symfony admin patterns.
  • Hybrid Projects: If your team uses both Symfony and Laravel, host the Symfony admin as a separate service and integrate via API.
  • Legacy Migration: If migrating from Symfony to Laravel, use this bundle as a temporary admin panel during transition.
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.
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/privacy-filter-classifier
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi