Skip to content
PHP API for Packagist
PHP
Branch: master
Clone or download
robbieaverill Merge pull request #59 from robbieaverill/pulls/1.6/psr-2
Fix PSR-2 linting errors and add lint check to Travis
Latest commit ee81483 Jul 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Added example May 18, 2015
spec/Packagist/Api Add getReplacementPackage() for abandoned packages and package versions Jul 23, 2019
src/Packagist/Api Merge pull request #59 from robbieaverill/pulls/1.6/psr-2 Jul 23, 2019
.gitattributes Add gitattributes for smaller download size Sep 7, 2015
.gitignore set to ignore all of the bin directory Jun 20, 2015
.travis.yml Add PHP 7.3 and fix bin path to phpcs Jul 23, 2019
LICENSE Update license year Sep 7, 2015
README.md
composer.json Fix PSR-2 linting errors and add lint check to Travis Jul 23, 2019

README.md

Packagist API

Build Status Latest Stable Version Total Downloads Dependency Status Reference Status

Simple object oriented wrapper for Packagist API.

Installation

The recommended way to install Packagist API is through composer:

$ composer require knplabs/packagist-api

Usage

Search for packages:

<?php

$client = new Packagist\Api\Client();

foreach ($client->search('sylius') as $result) {
    echo $result->getName();
}

// Outputs:
sylius/sylius
sylius/resource-bundle
sylius/cart-bundle
sylius/flow-bundle
sylius/sales-bundle
sylius/shipping-bundle
sylius/taxation-bundle
sylius/money-bundle
sylius/assortment-bundle
sylius/addressing-bundle
sylius/payments-bundle
sylius/taxonomies-bundle
sylius/inventory-bundle
sylius/settings-bundle
sylius/promotions-bundle
...

Get package details:

<?php

$package = $client->get('sylius/sylius');

printf(
    'Package %s. %s.',
    $package->getName(),
    $package->getDescription()
);

// Outputs:
Package sylius/sylius. Modern ecommerce for Symfony2.

List all packages:

<?php

foreach ($client->all() as $package) {
    echo $package;
}

// Outputs:
abhinavsingh/jaxl
abishekrsrikaanth/fuel-util
abmundi/database-commands-bundle
...

They can be filtered by type or vendor:

<?php

$client->all(array('type' => 'library'));
$client->all(array('vendor' => 'sylius'));

Custom Packagist Repositories

You can also set a custom Packagist Repository URL:

<?php

$client->setPackagistUrl('https://custom.packagist.site.org');

License

packagist-api is licensed under the MIT License - see the LICENSE file for details.

Maintainers

KNPLabs is looking for maintainers (see why).

If you are interested, feel free to open a PR to ask to be added as a maintainer.

We’ll be glad to hear from you :)

This library is maintained by the following people (alphabetically sorted) :

  • @robbieaverill
You can’t perform that action at this time.