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

Core Laravel Package

capell-app/core

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps

  1. Installation

    composer require capell-app/core
    

    Add the service provider to config/app.php:

    'providers' => [
        // ...
        Capell\App\Core\Providers\CoreServiceProvider::class,
    ],
    
  2. Publish Config & Migrations

    php artisan vendor:publish --provider="Capell\App\Core\Providers\CoreServiceProvider"
    

    Run migrations:

    php artisan migrate
    
  3. First Use Case: Content Model Define a basic content model in app/Models/Content/MyModel.php:

    namespace App\Models\Content;
    
    use Capell\App\Core\Models\ContentModel;
    
    class MyModel extends ContentModel
    {
        protected $modelName = 'my_model';
    }
    
  4. Register Model in config/capell.php

    'models' => [
        'my_model' => [
            'class' => \App\Models\Content\MyModel::class,
        ],
    ],
    

Implementation Patterns

1. Content Model Workflows

  • CRUD via API Use the built-in API endpoints (e.g., /api/content/my_model).

    // Create
    $data = $this->contentService->create('my_model', ['title' => 'Test']);
    
    // Fetch
    $item = $this->contentService->find('my_model', 1);
    
  • Event-Driven Extensions Listen to model events (e.g., ContentModelCreated):

    use Capell\App\Core\Events\ContentModelCreated;
    
    event(new ContentModelCreated($model));
    

2. Service Integration

  • Dependency Injection Bind services in AppServiceProvider:

    $this->app->bind(
        \Capell\App\Core\Contracts\ContentService::class,
        \Capell\App\Core\Services\ContentService::class
    );
    
  • Custom Services Extend core services:

    namespace App\Services;
    
    use Capell\App\Core\Services\ContentService;
    
    class MyContentService extends ContentService
    {
        public function customMethod() { ... }
    }
    

3. Extension Points

  • Model Extensions Add fields dynamically:

    class MyModel extends ContentModel
    {
        public function getCustomFieldAttribute()
        {
            return $this->attributes['custom_field'] ?? null;
        }
    }
    
  • Middleware for Content Protect routes:

    Route::middleware(['capell.auth'])->group(function () {
        // ...
    });
    

Gotchas and Tips

Common Pitfalls

  • Migration Conflicts If php artisan migrate fails, check config/capell.php for reserved table names. Fix: Rename tables in config/capell.php under database.tables.

  • Caching Issues Clear caches after extending models:

    php artisan config:clear
    php artisan cache:clear
    
  • Event Listener Registration Ensure listeners are registered in EventServiceProvider:

    protected $listen = [
        ContentModelCreated::class => [
            \App\Listeners\HandleModelCreated::class,
        ],
    ];
    

Debugging Tips

  • Log Model Events Enable debug mode in config/capell.php:

    'debug' => env('APP_DEBUG', false),
    
  • Check Contracts Verify implemented contracts (e.g., ContentService) match the package’s expectations.

Extension Quirks

  • Dynamic Field Validation Override getRules() in models:

    public function getRules()
    {
        return [
            'title' => 'required|string|max:255',
            'custom_field' => 'nullable|string',
        ];
    }
    
  • API Resource Customization Extend Capell\App\Core\Http\Resources\ContentResource for custom responses.

  • Localization Use config/capell.php to set default locale:

    'locale' => 'en',
    
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle