PHP code example of quitenoisemaker / shipping-tracker
1. Go to this page and download the library: Download quitenoisemaker/shipping-tracker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
quitenoisemaker / shipping-tracker example snippets
// In your test or local dev
ShippingTracker::use('fake')->track('ANY-NUMBER');
use Quitenoisemaker\ShippingTracker\Models\Shipment;
$shipment = Shipment::where('tracking_number', 'SB123456789')->first();
dd($shipment->history);
$history = ShippingTracker::getHistory('SB123456789');
// Returns a Shipment model. The 'history' attribute is cast to an array/json.
dd($history->history);
namespace App\ShippingProviders;
use Quitenoisemaker\ShippingTracker\Contracts\ShippingProvider;
class CustomProvider implements ShippingProvider
{
public function track(string $trackingNumber): array
{
// API call to your provider
return ['tracking_number' => $trackingNumber, 'status' => 'in_transit'];
}
public function handleWebhook(array $payload): void
{
// Process webhook data
}
}