PHP code example of scottbass3 / harbor-api-bundle

1. Go to this page and download the library: Download scottbass3/harbor-api-bundle 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/ */

    

scottbass3 / harbor-api-bundle example snippets


namespace App\Controller;

use Scottbass3\HarborApiBundle\HarborClient;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class DefaultController extends AbstractController {
    public function index(HarborClient $client) {
        $projectReq = (new ProjectReq())
            ->setProjectName('my-project');
        $client->getHarborClient()->createProject($projectReq); 
        
        $artifacts = $client->getHarborClient()->listArtifacts('my-project', 'my-repository');
    }
}