ghaninia / shipping

Calculate postage in Iran,This package supports Sefarshi and Pisthtaz drivers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculate postage in Iran

Installation

Go to the project root folder and run the following command

composer require ghaninia/shipping

If you want to make sure the system is correct, Run tests🐱‍🚀

vendor\bin\phpunit 

✔If you use package on laravel you should add below command to app.php

### config/app.php
<?php
    ....
    'providers' => [
        ...
        GhaniniaIR\Shipping\ShippingServiceProvider::class, ### ✔
    ],

Receive information of cities and provinces and their details

<?php 

use GhaniniaIR\Shipping\Core\Services\LocationService ;

### Get information on cities and provinces
(new LocationService())->list();

### Are the provinces adjacent to each other?
(new LocationService())
    ->source(State $state , City $city)
    ->destination(State $state , ?City $city)
    ->provincesNeighbors() ;

### Status of origin and destination together
(new LocationService())
    ->source(State $state , City $city)
    ->destination(State $state , ?City $city)
    ->situationStatesTogether() ; 

Calculate Post Pishtaz Tariff

<?php

use GhaniniaIR\Shipping\Drivers\PishtazDriver;
use GhaniniaIR\Shipping\Models\State ;
use GhaniniaIR\Shipping\Models\City ;

$result = (new PishtazDriver())
    ->weight(int $productWeight)
    ->cost(int $productCost)
    ->source(State $sourceState , City $sourceCity)
    ->destination(State $sourceState , ?City $sourceCity)
    ->calculate();

Calculate Post Sefareshi Tariff

<?php

use GhaniniaIR\Shipping\Drivers\SefarshiDriver;
use GhaniniaIR\Shipping\Models\State ;
use GhaniniaIR\Shipping\Models\City ;

$result = (new SefarshiDriver())
    ->weight(int $productWeight)
    ->cost(int $productCost)
    ->source(State $sourceState , City $sourceCity)
    ->destination(State $sourceState , ?City $sourceCity)
    ->calculate();

Reconnection

If you want to change the type of connection to the database, follow the code below

Laravel:
php artisan vendor:publish --tag=shipping --force

It will then be published to you in the database and configuration file

About

Calculate postage in Iran,This package supports Sefarshi and Pisthtaz drivers


Languages

Language:PHP 100.0%