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

Symfony Workflow Style Laravel Package

alexislefebvre/symfony-workflow-style

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Installation: Require the package via Composer:
    composer require vendor/package-name
    
  2. Configuration: Publish the config file (if applicable) and update the dump_style key (previously style in v0.1).
    php artisan vendor:publish --provider="Vendor\Package\ServiceProvider"
    
  3. First Use Case: Use the package’s core functionality (e.g., dumping data with a style):
    use Vendor\Package\Facades\Package;
    
    Package::dump($data, [
        'dump_style' => 'compact' // Updated key name (was 'style')
    ]);
    

Implementation Patterns

Core Workflow

  • Configuration-Driven: Centralize styles (e.g., dump_style) in config/package.php for consistency.
  • Facade Usage: Prefer the facade for simplicity:
    Package::log($data, ['dump_style' => 'verbose']);
    
  • Service Container: Bind custom styles or extend functionality via service providers:
    $this->app->bind('package.style.compact', function () {
        return new CustomCompactStyle();
    });
    

Integration Tips

  • Event Listeners: Hook into package events (if supported) to modify output dynamically.
  • Middleware: Use middleware to inject default styles for specific routes:
    public function handle($request, Closure $next) {
        config(['package.default_style' => 'compact']);
        return $next($request);
    }
    

Gotchas and Tips

Breaking Changes (v0.2)

  • Config Key Renamed: styledump_style (PR #10). Update all config files and hardcoded usages. Fix: Run php artisan config:clear after updating config.
  • Symfony Conflict: If using symfony/framework-bundle, ensure proper version constraints in composer.json to avoid conflicts (PR #9).

Debugging

  • Style Validation: Use dd(config('package')) to verify loaded styles.
  • Composer Conflicts: Resolve conflicts with symfony/framework-bundle by pinning versions or using replace in composer.json:
    "replace": {
        "symfony/framework-bundle": "6.0.*"
    }
    

Extension Points

  • Custom Styles: Extend the package by creating new style classes and registering them:
    class MyStyle implements StyleInterface {
        public function render($data) { ... }
    }
    
    Register in config/package.php:
    'styles' => [
        'my_style' => Vendor\Package\Styles\MyStyle::class,
    ],
    
  • Logging: Override the default logger if needed (check package docs for setLogger() method).

Pro Tips

  • Environment-Specific Styles: Use Laravel’s config caching to switch styles per environment:
    $this->mergeConfigFrom([
        'package.dump_style' => env('PACKAGE_STYLE', 'compact'),
    ]);
    
  • Testing: Mock the package’s facade or use partial mocks for unit tests:
    $this->partialMock(Package::class, ['dump']);
    
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