承接 pamekar/laravel-postnl-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pamekar/laravel-postnl-api

Composer 安装命令:

composer require pamekar/laravel-postnl-api

包简介

Laravel PostNL API package

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License StyleCI

Intergrates the PostNL API with Laravel 5 & 6 via a ServiceProvider and Facade.

Instalation

composer require deniztezcan/laravel-postnl-api

Add a ServiceProvider to your providers array in config/app.php:

    'providers' => [
    	//other things here

    	DenizTezcan\LaravelPostNLAPI\PostNLAPIServiceProvider::class,
    ];

Add the facade to the facades array:

    'aliases' => [
    	//other things here

    	'PostNLAPI' => DenizTezcan\LaravelPostNLAPI\Facades\PostNLAPI::class,
    ];

Finally, publish the configuration files:

php artisan vendor:publish --provider="DenizTezcan\LaravelPostNLAPI\PostNLAPIServiceProvider"

Configuration

Please set your API: url, key and Customer code, number, location, email and address in the config/postnlapi.php

Usage

To generate a barcode you can use the following call. To find which type and serie to use please check PostNL documentation

$barcode = PostNLAPI::generateBarcode('3S', '00000000000-99999999999');

To generate a label you can use the following call. To find which PrinterType, AddressType and ProductCodeDelivery to use please check PostNL documentation

use DenizTezcan\LaravelPostNLAPI\Entities\{Address, Contact};

$label = PostNLAPI::generateLabel(
	$barcode, 
	'GraphicFile|PDF',
	[Address::create([
        'AddressType' 	=> '01',
        'City'        	=> "Testdorp",
        'CompanyName' 	=> "Crusty Crab BV",
        'Countrycode' 	=> "NL",
        'HouseNr'     	=> "1",
        'Street'      	=> "Teststraat",
        'Zipcode'     	=> "1111AA",
        'FirstName'	  	=> "Meneer",
        'Name'	 	  	=> "Krabs"
    ]),
    Address::create([
        'AddressType'   => '09',
        'City'          => "Testdorp",
        'CompanyName'   => "Crusty Crab BV",
        'Countrycode'   => "NL",
        'HouseNr'       => "1",
        'Street'        => "Teststraat",
        'Zipcode'       => "1111AA",
        'FirstName'     => "Meneer",
        'Name'          => "Krabs"
    ])],
    [Contact::create([
    	'ContactType'	=> "01",
    	'Email'			=> 'test@meneer.nl',
    	'SMSNr'			=> '061111111',
    	'TelNr'			=> '061111111'
    ])],
    '01',
    '3085',
    'This is a reference',
    'This is a remark'
);

Note: Watch the Array which needs to be passed in the second and third parameter! Without this it will simply not work!

To get an array of the nearest PostNL locations you can use the following call. You have to pass the CountryCode and PostalCode as parameters.

$locations = PostNLAPI::nearestLocations('NL', '1111AA');

统计信息

  • 总下载量: 1.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-01