PHP code example of deniztezcan / laravel-postnl-api

1. Go to this page and download the library: Download deniztezcan/laravel-postnl-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

deniztezcan / laravel-postnl-api example snippets


    'providers' => [
    	//other things here

    	DenizTezcan\LaravelPostNLAPI\PostNLAPIServiceProvider::class,
    ];

    'aliases' => [
    	//other things here

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

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

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'			=> '[email protected]',
    	'SMSNr'			=> '061111111',
    	'TelNr'			=> '061111111'
    ])],
    '01',
    '3085',
    'This is a reference',
    'This is a remark'
);

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

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