PHP code example of paquet / packagist-client

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

    

paquet / packagist-client example snippets


use Paquet\Packagist\Packagist;

$packagist = Packagist::init();

use Paquet\Packagist\Credentials;
use Paquet\Packagist\Packagist;

$packagist = Packagist::init(
    credentials: Credentials::make(
        username: 'username',
        apiToken: 'api-token',
    ),
);

use Paquet\Packagist\Options;
use Paquet\Packagist\Packagist;

$packagist = Packagist::init(
    options: Options::make(
        userAgent: 'my-app/1.0 (mailto:[email protected])',
        baseUrl: 'https://packagist.example',
    ),
);

$packagist = Packagist::init(options: [
    'userAgent' => 'my-app/1.0 (mailto:[email protected])',
    'baseUrl' => 'https://packagist.example',
]);

use Paquet\Packagist\Packagist;

$packagist = Packagist::init();

use Paquet\Packagist\PackagistRepository;

$repository = PackagistRepository::init();
$metadata = $repository->packages->tagged('vendor/package');

use Paquet\Packagist\PackagistRepository;
use Paquet\Packagist\RepositoryOptions;

$repository = PackagistRepository::init(
    options: RepositoryOptions::make(
        userAgent: 'my-app/1.0 (mailto:[email protected])',
        baseUrl: 'https://repo.packagist.example',
    ),
);

$repository = PackagistRepository::init(options: [
    'userAgent' => 'my-app/1.0 (mailto:[email protected])',
    'baseUrl' => 'https://repo.packagist.example',
]);

use Paquet\Packagist\PackagistRepository;

$repository = PackagistRepository::init();