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

Platform Console Bundle Laravel Package

digitalstate/platform-console-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation Add the bundle via Composer:

    composer require digitalstate/platform-console-bundle
    

    Register the bundle in config/app.php under providers:

    DigitalState\PlatformConsoleBundle\PlatformConsoleBundle::class,
    
  2. First Use Case: Logging Errors Inject the logger service into a controller or command:

    use DigitalState\PlatformConsoleBundle\Logger\ConsoleLogger;
    
    public function __construct(private ConsoleLogger $logger) {}
    
    public function someAction() {
        try {
            // Risky operation
        } catch (\Exception $e) {
            $this->logger->error('Operation failed', ['exception' => $e]);
        }
    }
    
  3. Where to Look First

    • Logger: Check src/Logger/ConsoleLogger.php for available methods (error, warning, info).
    • Commands: Review src/Command/ for pre-built console utilities (if any exist in future updates).
    • Configuration: Look for config/platform_console.php (if auto-generated) for customization.

Implementation Patterns

Core Workflows

  1. Structured Logging Use contextual logging for debugging:

    $this->logger->info('User action', [
        'user_id' => $user->id,
        'action' => 'profile_update',
        'metadata' => $payload
    ]);
    
  2. Exception Handling Centralize error logging in a middleware or service:

    public function handle(Exception $e, $next) {
        $this->logger->error('Unhandled exception', ['exception' => $e]);
        return $next($request);
    }
    
  3. Todo Integration (Future-Proofing) If the Todo feature is added later, expect a service like:

    $this->todo->create('Refactor payment logic', 'high');
    $this->todo->list(); // Hypothetical method
    

Integration Tips

  • Symfony Console Commands Extend the bundle’s commands (if available) for custom CLI tools:

    namespace App\Command;
    
    use DigitalState\PlatformConsoleBundle\Command\BaseCommand;
    
    class CustomCommand extends BaseCommand {
        protected function configure() {
            $this->setName('app:custom-task');
        }
    
        protected function execute(InputInterface $input, OutputInterface $output) {
            $this->logger->info('Custom task started');
            // Logic here
        }
    }
    
  • Monolog Bridge If the bundle uses Monolog under the hood, configure it via config/logging.php for advanced formatting.


Gotchas and Tips

Pitfalls

  1. No Auto-Configuration Unlike popular bundles (e.g., Laravel’s laravel-debugbar), this bundle lacks auto-discovery. Manually register it in config/app.php.

  2. Limited Documentation The README is minimal. Assume undocumented features may break or lack consistency. Check the source (src/Logger/ConsoleLogger.php) for exact method signatures.

  3. Todo Feature Unreleased The Todo section in the README is placeholder text. Avoid relying on it until implemented.

Debugging

  • Logger Output Logs may not appear in storage/logs/laravel.log by default. Verify the bundle’s logger is configured to use Symfony’s logger:

    // In PlatformConsoleBundle's service definition
    $definition->setArgument('$logger', service('logger'));
    
  • Command Testing If extending commands, test with:

    php artisan app:custom-task --verbose
    

Extension Points

  1. Custom Log Channels Override the logger’s channel in config/logging.php:

    'channels' => [
        'console' => [
            'driver' => 'single',
            'path' => storage_path('logs/console.log'),
            'level' => 'debug',
        ],
    ],
    
  2. Hook into Log Events Use Symfony’s monolog.logger event dispatcher to modify logs:

    $dispatcher->addListener(Monolog\Logger::INFO, function($record) {
        // Transform or filter logs
    });
    
  3. Contributing Fork the repo and extend the ConsoleLogger class. Submit PRs to add features like:

    • Slack/Email notifications for critical errors.
    • Log rotation or retention policies.
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor