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

Api Laravel Package

app-dev-panel/api

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require app-dev-panel/api
    

    Add the service provider to config/app.php:

    'providers' => [
        // ...
        AppDevPanel\Api\ApiServiceProvider::class,
    ],
    
  2. Publish Config & Migrations

    php artisan vendor:publish --provider="AppDevPanel\Api\ApiServiceProvider"
    

    Run migrations:

    php artisan migrate
    
  3. First Use Case: Enable Debug Endpoints Add middleware to routes/web.php or routes/api.php:

    Route::middleware(['web', 'adp.debug'])->group(function () {
        // Your debug routes here
    });
    

    Test with:

    curl http://your-app.test/api/debug/inspect
    

Implementation Patterns

REST Endpoints for Debug Data

  • Structured Debug Dumps Use Adp\Debug\Dump facade to expose structured data:

    Route::get('/debug/data', function () {
        return Adp\Debug\Dump::table([
            'users' => User::all(),
            'config' => config('app'),
        ]);
    });
    
  • Live Inspection with SSE Stream real-time data via Server-Sent Events:

    Route::get('/debug/stream', function () {
        return Adp\Debug\Stream::event('user.created', fn ($user) => [
            'id' => $user->id,
            'name' => $user->name,
        ]);
    });
    

Workflows

  1. Debugging Live Requests

    • Use Adp\Debug\Trace to log request lifecycle:
      $trace = Adp\Debug\Trace::start('user_creation');
      // ... business logic ...
      $trace->end(['user_id' => $user->id]);
      
  2. Ingestion Pipeline

    • Forward debug data to external systems:
      Adp\Debug\Ingest::send('analytics', [
          'event' => 'user_login',
          'data' => $request->all(),
      ]);
      
  3. Role-Based Access

    • Restrict endpoints via middleware:
      Route::middleware(['adp.debug', 'auth:sanctum'])->group(function () {
          // Admin-only debug routes
      });
      

Gotchas and Tips

Pitfalls

  • Performance Overhead

    • Disable debug endpoints in production:
      ADP_DEBUG_ENABLED=false
      
    • Use Adp\Debug\Conditional to gate debug logic:
      if (Adp\Debug\Conditional::isEnabled()) {
          // Debug-only code
      }
      
  • SSE Connection Limits

    • Configure max connections in .env:
      ADP_SSE_MAX_CONNECTIONS=10
      
    • Monitor with Adp\Debug\Stream::stats().
  • Data Leakage

    • Sanitize sensitive data before dumping:
      Adp\Debug\Dump::table([
          'users' => User::select('id', 'name')->get(), // Exclude passwords
      ]);
      

Debugging Tips

  • Log Inspection Check raw debug logs at:

    tail -f storage/logs/adp-debug.log
    
  • Endpoint Health Verify SSE streams with:

    curl -N http://your-app.test/api/debug/stream
    
  • Custom Events Extend SSE events:

    Adp\Debug\Stream::extend('custom.event', function ($data) {
        // Custom logic
        return ['processed' => true, 'data' => $data];
    });
    

Extension Points

  • Custom Dump Formats Register a new dumper:

    Adp\Debug\Dump::extend('json', function ($data) {
        return json_encode($data, JSON_PRETTY_PRINT);
    });
    
  • Ingestion Handlers Add a new ingestion channel:

    Adp\Debug\Ingest::extend('slack', function ($data) {
        // Send to Slack
    });
    
  • Middleware Hooks Override debug logic in middleware:

    public function handle($request, Closure $next) {
        if ($request->hasHeader('X-ADP-TOKEN')) {
            Adp\Debug\Conditional::forceEnable();
        }
        return $next($request);
    }
    
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