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

Extbaser Laravel Package

edrush/extbaser

Laravel package providing Baseer-related integrations and utilities, offering helper classes and configuration to speed up common workflows. Lightweight and easy to drop into existing apps for basic setup, requests, and shared functionality.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation

    composer require edrush/extbaser --dev
    

    (Note: Package is now updated to v0.1.0; verify compatibility with Laravel 8+/9+.)

  2. Initial Setup

    • Run the Artisan command to generate ExtensionBuilder.json from your database schema:
      php artisan extbaser:generate
      
    • Configure the command via config/extbaser.php (if available) or command arguments.
  3. First Use Case

    • Define a database schema (e.g., users table with columns id, name, email).
    • Run the generator to auto-create:
      • ExtensionBuilder.json in your project root (defining modules, relations, and wires).
      • Optionally, generate Laravel Eloquent models if configured.
    • Verify the generated ExtensionBuilder.json for correctness.

Implementation Patterns

Workflows

  1. ExtensionBuilder-First Development

    • Use extbaser to scaffold ExtensionBuilder.json after defining the database schema.
    • Ideal for TYPO3 Extension Builder integration or when migrating legacy systems to a structured module system.
    • Example output structure:
      {
        "modules": {
          "User": {
            "table": "users",
            "relations": {
              "posts": {
                "type": "hasMany",
                "foreignKey": "user_id"
              }
            }
          }
        }
      }
      
  2. Integration with Laravel Eloquent

    • Optionally generate Eloquent models alongside ExtensionBuilder.json (if configured).
    • Customize models by extending them in app/Models/:
      // app/Models/User.php
      class User extends Model {
          protected $fillable = ['name', 'email'];
          public function posts() {
              return $this->hasMany(Post::class);
          }
      }
      
  3. TYPO3 Extension Builder Workflow

    • Use the generated ExtensionBuilder.json to scaffold TYPO3 extensions:
      vendor/bin/extension-builder create --json=ExtensionBuilder.json
      
    • Sync Laravel models with TYPO3 entities for unified backend/frontend logic.
  4. API and Repository Layer

    • Generate API resources (e.g., UserResource) and repositories to abstract business logic:
      // app/Repositories/UserRepository.php
      public function findWithPosts($userId) {
          return User::with('posts')->find($userId);
      }
      

Integration Tips

  • Database Configuration: Ensure .env has correct DB credentials before generation.
  • Custom Naming: Override table-to-module mappings in extbaser.php:
    'mappings' => [
        'users' => 'UserModule', // Maps `users` table to `UserModule` in ExtensionBuilder.json
    ],
    
  • Selective Generation: Use --tables to generate only specific tables:
    php artisan extbaser:generate --tables=users,posts
    
  • Relation Handling: Configure relation types (e.g., hasMany, belongsTo) in the config:
    'relations' => [
        'posts' => 'hasMany',
        'user' => 'belongsTo'
    ],
    

Gotchas and Tips

Pitfalls

  1. Breaking Changes in v0.1.0

    • Output Format Shift: No longer generates Eloquent models by default; focuses on ExtensionBuilder.json.
    • Migration: Update workflows to account for the new JSON output. Manually generate models if needed.
    • Workaround: Use --generate-models flag (if added) or post-process the JSON.
  2. TYPO3-Specific Quirks

    • ExtensionBuilder.json may require manual adjustments for TYPO3-specific fields (e.g., controllerActions).
    • Tip: Validate the JSON against TYPO3 Extension Builder docs.
  3. Limited Laravel Integration

    • No built-in support for:
      • Laravel Sanctum/Passport policies.
      • Soft deletes (add manually post-generation).
    • Tip: Extend models post-generation or use Laravel events.
  4. Relation Parsing Issues

    • Complex relations (e.g., many-to-many with pivot tables) may not auto-detect.
    • Solution: Configure relations explicitly in extbaser.php or edit ExtensionBuilder.json manually.

Debugging

  • Command Errors: Check storage/logs/laravel.log for schema parsing issues (e.g., missing foreign keys).
  • JSON Validation: Use a JSON validator to ensure ExtensionBuilder.json is syntactically correct.
  • Database Connection: Test with php artisan tinker:
    DB::connection()->getPdo();
    

Extension Points

  1. Custom JSON Templates

    • Override the default ExtensionBuilder.json template by publishing the config:
      php artisan vendor:publish --tag=extbaser-config
      
    • Extend the template to include TYPO3-specific fields (e.g., iconIdentifier).
  2. Post-Generation Scripts

    • Use Laravel’s booted event to sync ExtensionBuilder.json with models:
      // app/Providers/AppServiceProvider.php
      public function boot() {
          if (file_exists(base_path('ExtensionBuilder.json'))) {
              $this->syncExtensionBuilderWithModels();
          }
      }
      
  3. Testing

    • Test JSON generation with a known schema:
      public function test_extension_builder_json() {
          Artisan::call('extbaser:generate');
          $this->assertFileExists(base_path('ExtensionBuilder.json'));
          $json = json_decode(file_get_contents(base_path('ExtensionBuilder.json')), true);
          $this->assertArrayHasKey('modules', $json);
      }
      

Pro Tips

  • Pair with Laravel Nova: Use ExtensionBuilder.json to scaffold Nova resources:
    php artisan nova:resource User --model=User --json=ExtensionBuilder.json
    
  • TYPO3 Sync: Automate TYPO3 extension updates by watching ExtensionBuilder.json:
    // Use Laravel Filesystem events to trigger TYPO3 extension rebuilds.
    
  • Documentation: Generate API docs from ExtensionBuilder.json using tools like Swagger.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky