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

Rocket Laravel Package

fibers/rocket

Fibers Rocket adds developer-friendly Artisan commands to quickly scaffold common Laravel parts—models, controllers, migrations, views, layouts, routes, and more. Templates follow Laravel conventions, are easy to customize, and commands are context-aware to auto-fill boilerplate.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation:

    composer require-dev fibers/rocket
    

    Add to composer.json under require-dev to ensure it’s not deployed to production.

  2. Publish Config (Optional):

    php artisan vendor:publish --provider="Fibers\Rocket\RocketServiceProvider"
    

    Customize paths, templates, or naming conventions in config/rocket.php.

  3. First Use Case: Scaffold a full CRUD resource (model, migration, controller, views, routes) in one command:

    php artisan fibers:create Post
    

    This generates:

    • Model (app/Models/Post.php)
    • Migration (database/migrations/..._create_posts_table.php)
    • Controller (app/Http/Controllers/PostController.php)
    • Views (resources/views/posts/)
    • Route (routes/web.php)

    Verify:

    • Check routes/web.php for the new resource route.
    • Test the generated views in resources/views/posts/ (e.g., index.blade.php, create.blade.php).

Implementation Patterns

Core Workflows

1. Rapid MVC Scaffolding

  • Single Command CRUD:
    php artisan fibers:create User --resource
    
    Generates a full RESTful resource with all standard actions (index, create, store, etc.).
  • Partial Scaffolding:
    php artisan fibers:model User
    php artisan fibers:controller User
    php artisan fibers:views User
    
    Generate components independently.

2. Context-Aware Generation

  • Migration Fields: Define fields in the model ($fillable or $casts) to auto-generate migration columns:

    // app/Models/Post.php
    protected $fillable = ['title', 'content'];
    protected $casts = ['published_at' => 'datetime'];
    

    Run php artisan fibers:model Post to update the migration accordingly.

  • View Templates: Customize templates by overriding default files in:

    resources/views/rocket/
    

    Example: Override resources/views/rocket/layouts/app.blade.php to modify the base layout.

3. Integration with Existing Code

  • Extend Controllers: Add custom methods to generated controllers (e.g., app/Http/Controllers/PostController.php):

    public function customAction()
    {
        return response()->json(['message' => 'Custom logic']);
    }
    

    Update routes manually or use php artisan fibers:routes Post to regenerate.

  • Seeders: Use php artisan fibers:seeder User to generate a seeder with sample data based on the model’s fillable fields.

4. Custom Templates

  • Override Defaults: Copy templates from vendor/fibers/rocket/src/templates/ to resources/views/rocket/ to customize layouts, partials, or controllers. Example: Modify resources/views/rocket/controllers/resource.blade.php to change the controller structure.

  • Add New Templates: Extend the package by adding new template files in resources/views/rocket/ and reference them in the config.

5. API Resources

  • Generate API-specific controllers and resources:
    php artisan fibers:create Post --api
    
    Produces a controller with ApiResource and JSON responses.

Integration Tips

  • Laravel Mix/Vite: Ensure generated views include proper asset paths (e.g., @vite(['resources/css/app.css'])). Override resources/views/rocket/layouts/app.blade.php if needed.

  • Testing: Use php artisan fibers:test User to generate a feature test class with basic assertions for the scaffolded resource.

  • Database: Run migrations after scaffolding:

    php artisan migrate
    
  • Namespaces: Customize the namespace in config/rocket.php to match your project’s structure (e.g., App\Http\Controllers\Admin).


Gotchas and Tips

Pitfalls

  1. Overwriting Existing Files:

    • Rocket skips generation if files already exist. Use --force to overwrite:
      php artisan fibers:create Post --force
      
    • Tip: Check config/rocket.php for overwrite settings to control default behavior.
  2. Migration Conflicts:

    • If the migration already exists, Rocket won’t update it. Manually edit or delete and regenerate:
      php artisan fibers:migration Post
      
  3. Route Conflicts:

    • Generated routes may clash with existing ones. Review routes/web.php after running php artisan fibers:routes.
  4. Template Caching:

    • Changes to resources/views/rocket/ may not reflect immediately due to Laravel’s view caching. Clear cache:
      php artisan view:clear
      
  5. Deprecated Laravel Features:

    • The package was last updated in 2019 and may not support newer Laravel versions (e.g., 10.x). Test thoroughly or fork the package for updates.

Debugging

  • Command Output: Use --verbose for detailed logs:

    php artisan fibers:create Post --verbose
    
  • Template Errors: If a template fails to render, check:

    • File permissions in resources/views/rocket/.
    • Syntax errors in custom templates (use php artisan view:clear to reset).
  • Configuration Issues: Validate config/rocket.php for correct paths and settings. Example:

    'paths' => [
        'views' => resource_path('views/rocket'),
    ],
    

Tips

  1. Partial Scaffolding: Use individual commands for incremental development:

    php artisan fibers:model Post
    php artisan fibers:migration Post
    php artisan fibers:controller Post
    
  2. Reusable Components: Generate a base layout once and reuse it:

    php artisan fibers:layout admin
    

    Then extend it in other views.

  3. Custom Field Types: Extend the package by adding custom field types in config/rocket.php:

    'field_types' => [
        'rich_text' => ['type' => 'text', 'attributes' => 'class="trix-editor"'],
    ],
    
  4. Exclude Fields: Skip certain fields in migrations/views by marking them in the model:

    protected $hidden = ['api_token'];
    
  5. API + Web Hybrid: Generate both API and web controllers/views separately:

    php artisan fibers:create Post --api
    php artisan fibers:create Post --resource
    
  6. Backup Before Regenerating: Always back up custom files before running --force to avoid losing changes.

  7. Laravel Forge/Envoyer: Exclude rocket from deployment if using composer.json’s extra.deployer:

    "extra": {
        "deployer": {
            "ignore": ["vendor/fibers/rocket"]
        }
    }
    
  8. Legacy Support: For older Laravel versions, pin the package version in composer.json:

    "fibers/rocket": "dev-master"
    
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.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed