siad007/packagist

Packagist API Client and View-Helper-Collection for Zend Framework 2

1.0.1 2013-06-27 22:30 UTC

README

Packagist API Client and View Helpers for Zend Framework 2

Project Status

Build Status Coverage Status Latest Stable Version Latest Unstable Version Total Downloads

Dependency Status

Usage View Helper

Fetch

<?php
// fetch a list of all vendor-names/package-names (inside a view script)
echo $this->packagist()->fetch();

// will output something like
0x20h/monoconf
11ya/excelbundle
11ya/phpexcel
2085020/api_pingdom
2085020/zendframework1
...

// optional use of an other separator than <br />
echo $this->packagist()->fetch('|');

Display

<?php
// Displays a package (inside a view script)
echo $this->packagist()->display('siad007/packagist');

// will output something like
<ul>
    <li>siad007/packagist</li>
        <li>A Zend Framework module using the Packagist API</li>
        <li>zf2, ZendFramework</li>
        <li>1.0.0(1.0.0.0)</li>
        <li>BSD-3-Clause</li>
        <ul>
            <li>Siad Ardroumli, siad.ardroumli@gmail.com</li>
        </ul>
        ...
</ul>

Search

<?php
// for a query based search (inside a view script)
echo $this->packagist()->search(array('q' => 'ViewHelper_Packagist'));

// will output something like
<ul id="packagistList">
    <ul class="packagistRow">
        <li class="packagistName">
            <a href="https://packagist.org/packages/siad007/ViewHelper_Packagist">siad007/ViewHelper_Packagist</a>
        </li>
        <li class="packagistDescription">View Helper for Zend Framework 2 using the Packagist API</li>
        <li class="packagistDownloads">123</li>
        <li class="packagistFavors">0</li>
    </ul>
    ...
</ul>

// for a tag based search
echo $this->packagist()->search(array('tags' => 'zf1'));

// for multiple tags
echo $this->packagist()->search(array('tags' => array('zf1', 'view helper')));

// for a tag and query based search
echo $this->packagist()->search(array('q' => 'view helper', 'tags' => 'zf1'));

// or the most 15 popular packages
echo $this->packagist()->search(array('page' => '1', 'q' => ''));

License

BSD 3-Clause