Giter Club home page Giter Club logo

leopardscod-php's Introduction

Leopards Courier COD (Cash on Delivery) API Wrapper for PHP

Build Status Total Downloads Latest Stable Version License

This composer package offers quick booking packets via APIs on Leopards COD (Cash on Delivery) for your Laravel applications.

Installation

Begin by pulling in the package through Composer.

composer require developifynet/leopardscod-php

Laravel Framework Usage

Within your controllers, you can call LeopardsCOD facade and can send perform different operations.

Set Credentials

use \Developifynet\LeopardsCOD\LeopardsCOD;
public function index()
{
    LeopardsCOD::setCredentials(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ));
}

or setting up with data. See below endpoints where credentials are porvided within function data

Get All Cities

use \Developifynet\LeopardsCOD\LeopardsCOD;
public function index()
{
    $response = LeopardsCOD::setCredentials(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ))->getAllCities();
}

Book a Packet

use \Developifynet\LeopardsCOD\LeopardsCOD;
public function index()
{
    $response = LeopardsCOD::setCredentials(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ))->bookPacket(array(
        'booked_packet_weight' => '200',
        'booked_packet_vol_weight_w' => '',
        'booked_packet_vol_weight_h' => '',
        'booked_packet_vol_weight_l' => '',
        'booked_packet_no_piece' => '1',
        'booked_packet_collect_amount' => '1000',
        'booked_packet_order_id' => '1001',
        'origin_city' => 'string',                  /** Params: 'self' or 'integer_value' e.g. 'origin_city' => 'self' or 'origin_city' => 789 (where 789 is Lahore ID)
                                                     * If 'self' is used then Your City ID will be used.
                                                     * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation)
                                                     */
            
        'destination_city' => 'string',             /** Params: 'self' or 'integer_value' e.g. 'destination_city' => 'self' or 'destination_city' => 789 (where 789 is Lahore ID)
                                                     * If 'self' is used then Your City ID will be used.
                                                     * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) 
                                                     */
        // Shipper Information
        'shipment_name_eng' => 'self',
        'shipment_email' => 'self',
        'shipment_phone' => 'self',
        'shipment_address' => 'self',
        // Consingee Information
        'consignment_name_eng' => 'John Doe',
        'consignment_email' => '[email protected]',
        'consignment_phone' => '+923330000000',
        'consignment_address' => 'Test Address is used here',
        'special_instructions' => 'n/a',
     ));
}

Track Packet(s)

use \Developifynet\LeopardsCOD\LeopardsCOD;
public function index()
{
    $response = LeopardsCOD::setCredentials(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ))->trackPacket(array(
        'track_numbers' => 'LEXXXXXXXX',            // E.g. 'XXYYYYYYYY' OR 'XXYYYYYYYY,XXYYYYYYYY,XXYYYYYY' 10 Digits each number
     ));
}

Other Usage

Within your controllers, you can call LeopardsCODClient Object and call approperiate functions for your need.

You can set credentials in various ways. See below

Set Credentials

use \Developifynet\LeopardsCOD\LeopardsCODClient;
public function index()
{
    $leopards = new LeopardsCODClient(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ));
}

or using 'setCredentials'

use \Developifynet\LeopardsCOD\LeopardsCODClient;
public function index()
{
    $leopards = new LeopardsCODClient();
    
    $leopards->setCredentials(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ));
}

or setting up with data. See below endpoints where credentials are porvided within function data

Get All Cities

use \Developifynet\LeopardsCOD\LeopardsCODClient;
public function index()
{
    $leopards = new LeopardsCODClient();
    
    $response = $leopards->getAllCities(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
    ));
}

Book a Packet

use \Developifynet\LeopardsCOD\LeopardsCODClient;
public function index()
{
    $leopards = new LeopardsCODClient();
    
    $response = $leopards->bookPacket(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
        'booked_packet_weight' => '200',
        'booked_packet_vol_weight_w' => '',
        'booked_packet_vol_weight_h' => '',
        'booked_packet_vol_weight_l' => '',
        'booked_packet_no_piece' => '1',
        'booked_packet_collect_amount' => '1000',
        'booked_packet_order_id' => '1001',
        'origin_city' => 'string',                  /** Params: 'self' or 'integer_value' e.g. 'origin_city' => 'self' or 'origin_city' => 789 (where 789 is Lahore ID)
                                                     * If 'self' is used then Your City ID will be used.
                                                     * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation)
                                                     */
            
        'destination_city' => 'string',             /** Params: 'self' or 'integer_value' e.g. 'destination_city' => 'self' or 'destination_city' => 789 (where 789 is Lahore ID)
                                                     * If 'self' is used then Your City ID will be used.
                                                     * 'integer_value' provide integer value (for integer values read 'Get All Cities' api documentation) 
                                                     */
        // Shipper Information
        'shipment_name_eng' => 'self',
        'shipment_email' => 'self',
        'shipment_phone' => 'self',
        'shipment_address' => 'self',
        // Consingee Information
        'consignment_name_eng' => 'John Doe',
        'consignment_email' => '[email protected]',
        'consignment_phone' => '+923330000000',
        'consignment_address' => 'Test Address is used here',
        'special_instructions' => 'n/a',
     ));
}

Track Packet(s)

use \Developifynet\LeopardsCOD\LeopardsCODClient;
public function index()
{
    $leopards = new LeopardsCODClient();
    
    $response = $leopards->trackPacket(array(
        'api_key' => '<your_api_key>',              // API Key provided by LCS
        'api_password' => '<your_api_password>',    // API Password provided by LCS
        'enable_test_mode' => true,                 // [Optional] default value is 'false', true|false to set mode test or live
        'track_numbers' => 'LEXXXXXXXX',            // E.g. 'XXYYYYYYYY' OR 'XXYYYYYYYY,XXYYYYYYYY,XXYYYYYY' 10 Digits each number
     ));
}

leopardscod-php's People

Contributors

developifysns avatar efficientbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.