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

Support Bundle Laravel Package

avro/support-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the package via Composer (note: this is a Symfony2 bundle, not Laravel-compatible):

    composer require avro/support-bundle:dev-master
    

    For Laravel users: Since this is a Symfony2 bundle, you’ll need to adapt it or use a similar Laravel package like backpack/crud or laravel-support for support systems.

  2. Bundle Registration In config/app.php, register the bundle in the config['bundles'] array (Symfony2 only):

    Avro\SupportBundle\AvroSupportBundle::class => ['all' => true],
    
  3. First Use Case

    • Symfony2: Follow the README to enable FOSAnswerBundle and TwitterBootstrap for a basic Q&A system.
    • Laravel Alternative: Use Laravel’s built-in features (e.g., Route::resource, Eloquent models) to create a support system. Example:
      // routes/web.php
      Route::resource('support', SupportController::class);
      
      // app/Http/Controllers/SupportController.php
      public function index() {
          return view('support.index', ['questions' => Question::latest()->get()]);
      }
      

Implementation Patterns

Core Workflows

  1. Question/Answer System

    • Symfony2: Leverage FOSAnswerBundle for nested comments/replies.
    • Laravel: Create Eloquent models for Question and Answer with relationships:
      // app/Models/Question.php
      public function answers() {
          return $this->hasMany(Answer::class);
      }
      
      Use Laravel’s hasMany/belongsTo for threading.
  2. Styling

    • Symfony2: Use TwitterBootstrap via assets or bundles like KnpLabs/KnpPaginatorBundle.
    • Laravel: Integrate Bootstrap via CDN or Laravel Mix:
      // resources/js/app.js
      require('bootstrap');
      
  3. Pagination

    • Symfony2: Use KnpPaginatorBundle (already a dependency).
    • Laravel: Use Laravel’s built-in pagination:
      $questions = Question::paginate(10);
      
  4. Form Handling

    • Symfony2: Use Symfony’s form components or ExerciseHtmlPurifierBundle (dependency).
    • Laravel: Use Laravel Collective or native forms with validation:
      use Illuminate\Support\Facades\Validator;
      $validator = Validator::make($request->all(), [
          'title' => 'required|max:255',
          'body' => 'required',
      ]);
      

Gotchas and Tips

Pitfalls

  1. Symfony2 Dependency

    • This bundle is not Laravel-compatible. Avoid using it directly in Laravel projects.
    • Workaround: Study its architecture (e.g., FOSAnswerBundle integration) and adapt it to Laravel.
  2. Under Development

    • The bundle is unusable in its current state (per README). Expect breaking changes.
    • Tip: Use it only for reference or contribute to its development.
  3. Missing Documentation

    • No clear setup instructions beyond basic installation.
    • Tip: Check FOSAnswerBundle’s docs for Q&A functionality details.
  4. Bootstrap Dependency

    • Requires TwitterBootstrap for styling. In Laravel, ensure Bootstrap is loaded via:
      <!-- resources/views/layouts/app.blade.php -->
      <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
      

Debugging Tips

  1. Symfony2-Specific Issues

    • Use Symfony’s profiler (/app_dev.php/_profiler) to debug bundle behavior.
    • Laravel Alternative: Use Laravel Debugbar (barryvdh/laravel-debugbar).
  2. Form Validation

    • Symfony2 uses Symfony’s validation component. In Laravel, use:
      $request->validate([
          'title' => 'required',
          'body' => 'required|min:10',
      ]);
      
  3. Database Migrations

    • The bundle lacks migration examples. For Laravel, create migrations manually:
      php artisan make:migration create_questions_table
      
      Schema::create('questions', function (Blueprint $table) {
          $table->id();
          $table->string('title');
          $table->text('body');
          $table->boolean('is_solved')->default(false);
          $table->timestamps();
      });
      

Extension Points

  1. Custom Fields

    • Symfony2: Extend FOSAnswerBundle’s form types.
    • Laravel: Add custom fields to Eloquent models and forms:
      // app/Http/Requests/StoreQuestionRequest.php
      public function rules() {
          return [
              'tags' => 'sometimes|array',
              'tags.*' => 'exists:tags,name',
          ];
      }
      
  2. Notifications

    • Symfony2: Use Symfony’s event system or Swiftmailer.
    • Laravel: Use Laravel Notifications:
      use Illuminate\Support\Facades\Notification;
      Notification::route('mail', $user->email)
                  ->notify(new NewQuestionCreated($question));
      
  3. API Endpoints

    • Symfony2: Use Symfony’s REST components or FOSRestBundle.
    • Laravel: Create API routes with Laravel’s HTTP controllers:
      Route::apiResource('api/questions', ApiQuestionController::class);
      
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware