arthuryinzhen/laravel-jd-logistic

A laravel package of logistic for jd

dev-master 2019-01-12 10:43 UTC

This package is auto-updated.

Last update: 2022-01-14 13:56:29 UTC


README

Laravel 5 京东物流接口

Installation

The ActionLog Service Provider can be installed via Composer by requiring the arthuryinzhen/laravel-jd-logistic package and setting the minimum-stability to dev (required for Laravel 5) in your project's composer.json.

{
    "require": {
           "arthuryinzhen/laravel-jd-logistic": "dev-master"
    },
   
}

or

Require this package with composer:

composer require arthuryinzhen/laravel-jd-logistic dev-master

Update your packages with composer update or install with composer install.

Usage

To use the ActionLog Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this.

Find the providers key in config/app.php and register the ActionLog Service Provider.

    'providers' => [
        // ...
        
        'Arthuryinzhen\JDLogistic\JDLogisticServiceProvider',
    ]

for Laravel 5.1+

    'providers' => [
        // ...
        Arthuryinzhen\JDLogistic\JDLogisticServiceProvider::class,
    ]

Find the aliases key in config/app.php.

    'aliases' => [
        // ...
        'JDLogistic' => 'Arthuryinzhen\JDLogistic\Facades\JDLogisticFacade',
    ]

for Laravel 5.1+

    'aliases' => [
        // ...
        'JDLogistic' => Arthuryinzhen\JDLogistic\Facades\JDLogisticFacade::class,
    ]

Configuration

To use your own settings, publish config.

$ php artisan vendor:publish

config/JdLogistic.php

	'client' => [
            'appKey'      => env('JD_CLIENT_APP_KEY', '26EAC2509056EB38FB623D9A49296D2C'),
            'appSecret'   => env('JD_CLIENT_APP_SECRET', '1abdc5a97ecb4594ab7b772296bcfbbd'),
            'accessToken' => env('JD_CLIENT_ACCESS_TOKEN', '1f1d3048-220a-484d-ad93-f3808d9aacc1'),
            'serverUrl'   => env('JD_CLIENT_SERVER_URL', 'https://api.jd.com/routerjson'),
        ],

Last Step

modify you .env

JD_CLIENT_APP_KEY=
JD_CLIENT_APP_SECRET=
JD_CLIENT_ACCESS_TOKEN=
JD_CLIENT_SERVER_URL="https://api.jd.com/routerjson"

Demo

public function getTest(Request $request)
{
    $array = $request->input();
    $lotus = new JDLogisticRepository();
    $result = $lotus->ldopWaybillReceiveRequest($array);
    dd($result);
}