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

Iptv Core Laravel Package

felipemateus/iptv-core

Laravel 9 package providing IPTV core features for Laravel apps, with database migrations and locale support (pt-BR, en). Note: this package has been moved to laravel-iptv-cms.

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require felipemateus/iptv-core
    php artisan migrate
    
    • Verify Laravel version compatibility (tested on 9.x and 11.x).
  2. First Use Case

    • Dashboard Integration: The package provides a pre-built dashboard layout. Extend the base dashboard class (Dashboard) to create custom admin panels:
      use FelipeMateus\IPTVCore\Dashboard;
      
      class CustomDashboard extends Dashboard
      {
          public function __construct()
          {
              parent::__construct();
              $this->title = 'My IPTV Dashboard';
              $this->menuItems = [
                  ['route' => 'channels.index', 'label' => 'Channels'],
                  ['route' => 'epg.index', 'label' => 'EPG'],
              ];
          }
      }
      
    • Register the dashboard in routes/web.php:
      Route::get('/dashboard', [CustomDashboard::class, 'index']);
      
  3. Key Files to Explore

    • resources/views/vendor/iptv-core/ – Base layouts and partials.
    • FelipeMateus\IPTVCore\Dashboard – Core dashboard class.
    • config/iptv-core.php – Configuration (e.g., menu structure, locales).

Implementation Patterns

1. Dashboard Customization

  • Extend Dashboard Class: Override methods like getMenuItems(), getTitle(), or getContent() to tailor the dashboard.
    class AdminDashboard extends Dashboard
    {
        public function getContent()
        {
            return view('admin.dashboard.content');
        }
    }
    
  • Dynamic Menu Items: Use closures or route names for dynamic menus:
    $this->menuItems = collect([
        ['route' => 'channels.index', 'label' => 'Channels'],
        ['route' => fn() => route('stats'), 'label' => 'Analytics'],
    ]);
    

2. Layout Inheritance

  • Base Layout: The package provides a default layout (resources/views/vendor/iptv-core/layouts/app.blade.php). Extend it in your project:
    @extends('iptv-core::layouts.app')
    @section('content')
        <!-- Custom content -->
    @endsection
    
  • Partial Overrides: Override specific partials (e.g., header, footer) by publishing assets:
    php artisan vendor:publish --tag=iptv-core-views
    

3. Localization

  • Supported Locales: en (English) and br (Portuguese-Brazilian).
  • Add Custom Translations: Publish language files:
    php artisan vendor:publish --tag=iptv-core-lang
    
    Then extend resources/lang/{locale}/iptv-core.php.

4. Business Fields

  • The package includes "business fields" (metadata fields) for extensibility. Use them via:
    use FelipeMateus\IPTVCore\BusinessFields\BusinessField;
    
    $field = new BusinessField();
    $field->name('custom_field')
          ->type('text')
          ->label('Custom Label')
          ->required();
    

5. Integration with iptv-channels

  • While this package is a core dependency, pair it with felipemateus/iptv-channels for full IPTV functionality:
    composer require felipemateus/iptv-channels
    
  • Share menu items or layouts between packages using the Dashboard class.

Gotchas and Tips

Pitfalls

  1. Archived Package:

    • The package is archived and moved to laravel-iptv-cms. Monitor for updates or fork if critical bugs arise.
  2. Asset Removal:

    • v1.3.0 removed CSS assets. If you relied on them, restore from v1.2.0 or implement custom styling:
      git checkout v1.2.0 -- resources/views/vendor/iptv-core/assets/
      
  3. Laravel Version Quirks:

    • Tested on Laravel 9/11. For Laravel 10, check compatibility or patch the Dashboard class:
      // Example: Fix route caching in Laravel 10+
      protected function getRouteCache()
      {
          return app('router')->getRoutes()->getByName($this->route);
      }
      
  4. Migration Conflicts:

    • The config table migration might conflict with existing setups. Publish and modify migrations:
      php artisan vendor:publish --tag=iptv-core-migrations
      

Debugging Tips

  1. Dashboard Not Loading:

    • Ensure the Dashboard class is properly registered in routes and the index() method is defined:
      public function index()
      {
          return view('iptv-core::dashboard')->with('dashboard', $this);
      }
      
  2. Menu Items Missing:

    • Verify menuItems is an array of associative arrays with route and label keys. Use route names (not URLs) for consistency:
      ['route' => 'channels.index', 'label' => 'Channels'] // Correct
      ['route' => '/channels', 'label' => 'Channels']     // May fail
      
  3. Localization Fallback:

    • If translations are missing, set a fallback locale in config/app.php:
      'fallback_locale' => 'en',
      

Extension Points

  1. Custom Dashboard Components:

    • Add widgets to the dashboard by extending the getContent() method:
      public function getContent()
      {
          return view('iptv-core::dashboard.content', [
              'widgets' => [
                  new ChannelStatsWidget(),
                  new RecentActivityWidget(),
              ],
          ]);
      }
      
  2. Business Field Validation:

    • Extend BusinessField to add custom validation rules:
      $field->rules(['unique:channels,name', 'max:50']);
      
  3. Menu Item Permissions:

    • Integrate with Laravel's gates/policies to restrict menu items:
      $this->menuItems = auth()->user()->can('access-dashboard')
          ? [['route' => 'dashboard', 'label' => 'Dashboard']]
          : [];
      
  4. Theme Support:

    • Override the default layout by publishing views and modifying the app.blade.php template:
      php artisan vendor:publish --tag=iptv-core-views
      
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.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
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
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony