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

Console Laravel Package

apie/console

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require apie/console
    

    Requires PHP 8.1+ and Laravel 9+ (inferred from Apie's ecosystem).

  2. First Use Case The package provides CLI utilities for API development. Start by inspecting the apie/console namespace for available commands. Run:

    php artisan list apie
    

    (If no commands appear, check if the package registers them via service provider.)

  3. Basic Integration Publish the package's config (if available) and bind the Apie\Console\ConsoleServiceProvider in config/app.php:

    'providers' => [
        // ...
        Apie\Console\ConsoleServiceProvider::class,
    ],
    

Implementation Patterns

Common Workflows

  1. Command Registration Extend Apie\Console\BaseCommand for custom commands:

    namespace App\Console\Commands;
    
    use Apie\Console\BaseCommand;
    
    class GenerateApiCommand extends BaseCommand
    {
        protected $signature = 'apie:generate {name}';
        protected $description = 'Generate API boilerplate';
    
        public function handle()
        {
            $this->info('Generating API for: ' . $this->argument('name'));
            // Logic here
        }
    }
    

    Register in app/Console/Kernel.php:

    protected $commands = [
        \App\Console\Commands\GenerateApiCommand::class,
    ];
    
  2. API Interaction via CLI Use the package to interact with Apie's core (e.g., schema generation, validation):

    php artisan apie:schema:generate --path=app/Http/Schemas
    

    (Verify available commands via php artisan or the package's source.)

  3. Event Listeners Attach listeners to Apie events (e.g., apie.schema.generated) for post-processing:

    namespace App\Listeners;
    
    use Apie\Console\Events\SchemaGenerated;
    
    class LogSchemaEvent
    {
        public function handle(SchemaGenerated $event)
        {
            \Log::info('Schema generated:', ['path' => $event->path]);
        }
    }
    

    Register in EventServiceProvider.

  4. Configuration Overrides Override Apie's console config (if published) in config/apie.php:

    'console' => [
        'default_command' => 'apie:schema:validate',
        'log_level' => 'debug',
    ],
    

Gotchas and Tips

Pitfalls

  1. No Public Documentation

    • The package lacks official docs. Reverse-engineer usage by:
    • Example: If commands fail silently, enable debug mode in config/apie.php:
      'debug' => env('APP_DEBUG', true),
      
  2. Monorepo Quirks

    • PRs must target the monorepo, not this package directly.
    • Dependencies may be version-locked to the monorepo’s composer.json.
  3. Laravel Integration

    • Ensure the package’s service provider is loaded after Laravel’s ArtisanServiceProvider.
    • If commands don’t register, manually bind them in register():
      $this->commands([
          \Apie\Console\Commands\ValidateSchema::class,
      ]);
      
  4. Event System

    • Events like apie.schema.validated may not be documented. Discover them via:
      \Apie\Console\Events\*; // Check the namespace for available events.
      

Debugging Tips

  • Enable Verbose Output Use --verbose with commands to debug:
    php artisan apie:schema:generate --verbose
    
  • Check Logs Apie logs to storage/logs/laravel.log by default. Increase log level:
    'console' => [
        'log_level' => 'debug',
    ],
    
  • Test in Tinker For one-off API interactions, use Laravel Tinker:
    php artisan tinker
    >>> \Apie\Console\Helpers::validateSchema('path/to/schema');
    

Extension Points

  1. Custom Commands Extend BaseCommand to reuse Apie’s CLI helpers (e.g., output formatting, argument parsing):

    use Apie\Console\Helpers;
    
    class CustomCommand extends BaseCommand {
        public function handle() {
            Helpers::line('Custom output', 'comment');
        }
    }
    
  2. Middleware for Commands Add middleware to commands via traits or decorators:

    use Apie\Console\Traits\AuthenticatesCommands;
    
    class SecureCommand extends BaseCommand {
        use AuthenticatesCommands;
        // ...
    }
    
  3. Hook into Apie’s Pipeline Override Apie’s console pipeline in app/Providers/AppServiceProvider:

    public function boot() {
        \Apie\Console\ConsoleServiceProvider::macro('extendPipeline', function ($pipeline) {
            $pipeline->prepend(\App\Console\Middleware\LogCommand::class);
        });
    }
    
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.
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed