PHP code example of pkgdist / pkgdist-client

1. Go to this page and download the library: Download pkgdist/pkgdist-client 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/ */

    

pkgdist / pkgdist-client example snippets


// config/pkgdist-client.php
return [
    'endpoint' => env('PKGDIST_CLIENT_ENDPOINT'),
];

use Pkgdist\Client\Package;

$package = Package::load(
    package: 'vendor/package-name',
    slug: 'your-tenant-slug',
    token: 'your-license-token',
);

$changelogs = $package->changelogs();

foreach ($changelogs as $changelog) {
    echo $changelog->version;     // e.g. "1.2.0"
    echo $changelog->content;     // markdown release notes
    echo $changelog->created_at;  // ISO-8601 timestamp
}

$latest = $package->changelogs()->first();

$recent = $package->changelogs()
    ->sortByDesc('created_at')
    ->take(5);

use Illuminate\Support\Facades\Http;

$response = Http::pkgdist()
    ->withToken($licenseToken)
    ->get('some/endpoint');
bash
php artisan vendor:publish --tag=config --provider="Pkgdist\Client\ClientServiceProvider"