answear/dpd-pl-pickup-services-bundle
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:
composer require answear/dpd-pl-pickup-services-bundle
php artisan vendor:publish --provider="Answ\DpdPlPickupServicesBundle\DpdPlPickupServicesBundle" --tag="config"
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
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();
config/app.php or use dependency injection:
$this->app->bind(PudoListStreaming::class, function ($app) {
return new PudoListStreaming($app['config']['dpd_pl']);
});
facade_app('DpdPlPickupServices')->getLocations();
$locations = Cache::remember('dpd_locations', 3600, function () {
return $streaming->getLocations()->toArray();
});
PUDOListStreaming class now uses less memory during streaming (thanks to PR #16). Ideal for large datasets or high-traffic applications.stream() method is used instead of eager-loading all data at once.config/dpd_pl.php contains valid API keys and endpoints. Example:
'api' => [
'key' => env('DPD_PL_API_KEY'),
'endpoint' => 'https://api.dpd.pl/pickup',
],
PudoListStreaming to add domain-specific filters:
class CustomPudoStreaming extends PudoListStreaming {
public function filterByDistance(float $maxDistanceKm) { /* ... */ }
}
$streaming->setLogger(app(MonologLogger::class));
How can I help you explore Laravel packages today?