yasserbelhimer/laravel-yalidine-dz-api is a Laravel package for yalidine api.
It currently has 14 GitHub stars and 61 downloads on Packagist (latest version v1.0).
Install it with composer require yasserbelhimer/laravel-yalidine-dz-api.
Discover more Laravel packages by yasserbelhimer
or browse all Laravel packages to compare alternatives.
Last updated
Simple laravel package to use Yalidine dz API
This package allows you to consume Yalidine dz Api using laravel.
composer require yasserbelhimer/laravel-yalidine-dz-api
First at all generate your api and token in yalidine website https://www.yalidine.com/
Set API ID and API TOKEN in the .env
YALIDINE_API_ID= your yalidine api id
YALIDINE_API_TOKEN= your yalidine api token
Once installed you can do stuff like this:
To get all your parcels pass an empty array to getParcels([]) function.
$parcels = Yalidine::getParcels([]);
To get some specific parcels pass an array of tracking parcels getParcels($trackings) function.
$trackings = ['YAL-PAR1','YAL-PAR2'....]; // list of your parcels tracking
$parcels = Yalidine::getParcels($trackings);
To create new parcels pass an array of parcels to createParcels($parcels) function.
$parcels = array( // the array that contains all the parcels
array ( // first parcel
"order_id"=>"MyFirstOrder",
"firstname"=>"Brahim",
"familyname"=>"Mohamed",
"contact_phone"=>"0123456789,",
"address"=>"Cité Kaidi",
"to_commune_name"=>"Bordj El Kiffan",
"to_wilaya_name"=>"Alger",
"product_list"=>"Presse à café",
"price"=>3000,
"freeshipping"=> true,
"is_stopdesk"=> false,
"has_exchange"=> 0,
"product_to_collect" => null
),
array ( // second parcel
"order_id" =>"MySecondOrder",
"firstname"=>"رفيدة",
"familyname"=>"بن مهيدي",
"contact_phone"=>"0123456789",
"address"=>"حي الياسمين",
"to_commune_name"=>"Ouled Fayet",
"to_wilaya_name"=>"Alger",
"product_list"=>"كتب الطبخ",
"price"=>2400,
"freeshipping"=>0,
"is_stopdesk"=>0,
"has_exchange"=> false,
),
array ( // third parcel
...
),
array( // etc
...
)
);
$response = Yalidine::createParcels($parcels );
This function will return an array of object:
{
"MyFirstOrder": {
"success": true,
"order_id": "MyFirstOrder",
"tracking": "yal-12345A",
"import_id": 234
},
"MySecondOrder": {
"success": true,
"order_id": "MySecondOrder",
"tracking": "yal-67891B",
"import_id": 234
}
}
To delete parcels pass an array of tracking parcels to deleteParcels($trackings) function.
$trackings = ['YAL-PAR1','YAL-PAR2'....]; // list of your parcels tracking
$deliveryFees = Yalidine::deleteParcels($trackings);
$deliveryFees = Yalidine::getDeliveryFees();