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

Dpd Pl Pickup Services Bundle Laravel Package

answear/dpd-pl-pickup-services-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

This package, answear/dpd-pl-pickup-services-bundle, is a Laravel integration for DPD PL pickup services, enabling developers to stream pickup locations efficiently. To get started:

  1. Installation: Require the package via Composer:
    composer require answear/dpd-pl-pickup-services-bundle
    
  2. Publish Config: Publish the configuration file (if needed):
    php artisan vendor:publish --provider="Answ\DpdPlPickupServicesBundle\DpdPlPickupServicesBundle" --tag="config"
    
  3. First Use Case: Use PUDOListStreaming to fetch pickup locations with optimized memory usage (now improved in v4.2.0):
    use Answ\DpdPlPickupServicesBundle\Services\PudoListStreaming;
    
    $streaming = new PudoListStreaming($config);
    $locations = $streaming->getLocations(); // Streamed with reduced memory footprint
    

Implementation Patterns

Core Workflow

  1. Streaming Locations: Leverage PUDOListStreaming for memory-efficient retrieval of pickup locations (e.g., for large datasets or real-time APIs):
    $streaming = resolve(PudoListStreaming::class);
    $streaming->setFilters(['city' => 'Warsaw'])->stream();
    
  2. Integration with Laravel Services: Bind the service to the container in config/app.php or use dependency injection:
    $this->app->bind(PudoListStreaming::class, function ($app) {
        return new PudoListStreaming($app['config']['dpd_pl']);
    });
    
  3. Event-Driven Extensions: Extend functionality by listening to package events (if applicable) or wrapping the service in a facade for cleaner syntax:
    facade_app('DpdPlPickupServices')->getLocations();
    

Common Use Cases

  • Bulk Location Fetching: Stream locations in chunks to avoid memory overload (now optimized in v4.2.0).
  • API Wrappers: Use the package as a backend for custom APIs or frontend services (e.g., Vue/React).
  • Caching: Cache streamed results in Laravel’s cache system for performance:
    $locations = Cache::remember('dpd_locations', 3600, function () {
        return $streaming->getLocations()->toArray();
    });
    

Gotchas and Tips

Memory Optimization (v4.2.0)

  • Key Improvement: The PUDOListStreaming class now uses less memory during streaming (thanks to PR #16). Ideal for large datasets or high-traffic applications.
  • Debugging: If memory issues persist, verify:
    • The stream() method is used instead of eager-loading all data at once.
    • No unnecessary transformations are applied to the streamed data in-memory.

Configuration Quirks

  • API Credentials: Ensure config/dpd_pl.php contains valid API keys and endpoints. Example:
    'api' => [
        'key' => env('DPD_PL_API_KEY'),
        'endpoint' => 'https://api.dpd.pl/pickup',
    ],
    
  • Rate Limits: Monitor API rate limits if streaming large volumes. Implement retries or exponential backoff for failed requests.

Extension Points

  • Custom Filters: Extend PudoListStreaming to add domain-specific filters:
    class CustomPudoStreaming extends PudoListStreaming {
        public function filterByDistance(float $maxDistanceKm) { /* ... */ }
    }
    
  • Logging: Add logging for debugging or auditing:
    $streaming->setLogger(app(MonologLogger::class));
    

Deprecations/Breaking Changes

  • None in v4.2.0: This release is a non-breaking optimization. However, always check the full changelog for future updates.
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
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