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

Business Website Theme Bundle Laravel Package

alphalemon/business-website-theme-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require alphalemon/business-website-theme-bundle
    

    Ensure alphalemon/app-business-* dependencies are installed (they’re auto-resolved via require in composer.json).

  2. Publish Assets

    php artisan vendor:publish --provider="AlphaLemon\BusinessWebsiteThemeBundle\BusinessWebsiteThemeBundle" --tag=public
    php artisan vendor:publish --provider="AlphaLemon\BusinessWebsiteThemeBundle\BusinessWebsiteThemeBundle" --tag=views
    

    This copies theme assets (CSS/JS) and Blade templates to public/vendor/business-theme/ and resources/views/vendor/business-theme/.

  3. Apply Theme Globally In config/app.php, add the bundle to the providers array:

    AlphaLemon\BusinessWebsiteThemeBundle\BusinessWebsiteThemeBundle::class,
    

    Then extend your base layout (e.g., resources/views/layouts/app.blade.php) to include the theme’s partials:

    @extends('business-theme::base')
    @section('content')
        {{ $slot }}
    @endsection
    
  4. First Use Case: Quick Styling Override a single component (e.g., header) by creating resources/views/vendor/business-theme/partials/header.blade.php. The theme uses Blade inheritance, so extend/modify as needed.


Implementation Patterns

1. Component-Based Workflow

  • Partial Templates: The theme ships with modular partials (e.g., header, footer, slider). Override them in resources/views/vendor/business-theme/ to customize without forking.
    @extends('business-theme::partials/header')
    @section('header-nav')
        <!-- Custom navigation -->
    @endsection
    
  • Dynamic Content: Use Blade directives like @inject or service containers to pass data to partials:
    @inject('menu', 'App\Services\MenuService')
    @include('business-theme::partials/menu', ['items' => $menu->getItems()])
    

2. Asset Management

  • CSS/JS: Published assets are in public/vendor/business-theme/. Override them by copying files to public/css/ or public/js/ with the same structure.
  • Versioning: Append ?v={{ filemtime(public_path('vendor/business-theme/css/theme.css')) }} to cache-bust CSS/JS in production.

3. Integration with AlphaLemon Bundles

  • Slider/Carousel: Use the app-business-slider-bundle and app-business-carousel-bundle via their service providers:
    $slider = app(\AlphaLemon\AppBusinessSliderBundle\Slider::class);
    
    Render in Blade:
    @component('business-theme::partials/slider', ['slides' => $slider->getSlides()])
    @endcomponent
    

4. Configuration

  • Theme Settings: Publish the config file:
    php artisan vendor:publish --tag=business-theme-config
    
    Customize in config/business-theme.php (e.g., colors, breakpoints).

5. Localization

  • Translations: Override theme strings by publishing translations:
    php artisan vendor:publish --tag=business-theme-translations
    
    Edit resources/lang/en/business-theme.php.

Gotchas and Tips

Pitfalls

  1. Dependency Hell:

    • The bundle requires dev-master versions of AlphaLemon’s sub-bundles. Pin versions in composer.json to avoid breaking changes:
      "repositories": [
        {"type": "vcs", "url": "https://github.com/alphalemon/app-business-slider-bundle"}
      ],
      "require": {
        "alphalemon/app-business-slider-bundle": "1.0.0"
      }
      
    • Fix: Use composer update --with-dependencies cautiously.
  2. Asset Overrides:

    • If you override theme.css but forget to clear Laravel’s cache, changes won’t reflect. Run:
      php artisan cache:clear
      php artisan view:clear
      
  3. Blade Inheritance Conflicts:

    • The theme assumes @extends('business-theme::base'). If your layout extends a different template, partials may break. Use @stack/@push for granular control:
      @push('styles')
          <link rel="stylesheet" href="/custom.css">
      @endpush
      
  4. Slider/Carousel Initialization:

    • The app-business-slider-bundle may require jQuery or specific JS libraries. Ensure they’re loaded in resources/views/layouts/app.blade.php before the theme’s JS:
      <script src="https://code.jquery.com/jquery-3.6.min.js"></script>
      @include('business-theme::scripts')
      

Debugging Tips

  1. Check Published Files:

    • Verify assets/views were published to the correct directories. Use:
      ls public/vendor/business-theme/
      ls resources/views/vendor/business-theme/
      
  2. Blade Debugging:

    • Enable Blade debugging in config/view.php:
      'debug' => env('APP_DEBUG', true),
      
    • Use @dump($variable) in Blade templates to inspect data.
  3. Service Container Issues:

    • If @inject fails, bind the service manually in a service provider:
      $this->app->bind(\AlphaLemon\AppBusinessSliderBundle\Slider::class, function ($app) {
          return new \AlphaLemon\AppBusinessSliderBundle\Slider();
      });
      

Extension Points

  1. Custom Components:

    • Create a new partial in resources/views/vendor/business-theme/partials/ (e.g., custom-card.blade.php) and include it via:
      @include('business-theme::partials.custom-card', ['data' => $customData])
      
  2. Theme Hooks:

    • The bundle may use @stack for extensibility. Check resources/views/vendor/business-theme/base.blade.php for hooks like @stack('footer-scripts').
  3. Dynamic Theme Switching:

    • Override the bundle’s ThemeService to support multiple themes:
      $this->app->singleton(\AlphaLemon\BusinessWebsiteThemeBundle\Services\ThemeService::class, function ($app) {
          return new \App\Services\CustomThemeService();
      });
      
  4. Webpack Mix Integration:

    • If using Laravel Mix, exclude the theme’s assets and compile your own:
      // webpack.mix.js
      mix.disableSuccessNotifications();
      mix.sass('resources/sass/app.scss', 'public/css');
      
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