PHP code example of augmentedlogic / maven-central-api

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

    

augmentedlogic / maven-central-api example snippets




com\augmentedlogic\mavencentralapi\MavenCentralClient;
use \com\augmentedlogic\mavencentralapi\Result;

$mcc = new MavenCentralClient();

$results = $mcc->searchByGroupId("com.augmentedlogic.simpleslack");
 foreach($results as $r) {
     print "-- doc --\n";
     print $r->getTimestamp()."\n";
     print $r->getVersion()."\n";
     print $r->getArtifactId()."\n";
     print $r->getWebLink()."\n";
 }

sleep(1);

$results = $mcc->search("log");
 foreach($results as $a) {
     print "-- doc --\n";
     print $r->getTimestamp()."\n";
     print $r->getLatestVersion()."\n";
     print $r->getArtifactId()."\n";
     print $r->getWebLink()."\n";
 }

sleep(1);

$results = $mcc->searchByArtifact("guice");
 foreach($results as $r) {
     print "-- doc --\n";
     print $r->getTimestamp()."\n";
     print $r->getLatestVersion()."\n";
     print $r->getArtifactId()."\n";
     print $r->getWebLink()."\n";
 }