-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path12-package-feed.php
More file actions
34 lines (28 loc) · 803 Bytes
/
12-package-feed.php
File metadata and controls
34 lines (28 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types = 1);
require_once __DIR__ . '/../vendor/autoload.php';
$pecl = Pickling\Factory::createPecl();
$packageName = 'amqp';
try {
$feed = $pecl->getPackageFeed($packageName);
} catch (RuntimeException $exception) {
printf('No feed found for package %s.' . PHP_EOL, $packageName);
exit(1);
}
echo 'Feed for channel (',
$feed->getChannel(),
')',
' title (',
$feed->getTitle(),
')',
' description (',
$feed->getDescription(),
')',
PHP_EOL;
echo sprintf('Found %d entries for package %s', count($feed), $packageName), PHP_EOL;
foreach ($feed as $item) {
echo '#', $feed->key(), PHP_EOL;
echo 'Title : ', $item->getTitle(), PHP_EOL;
echo 'Link : ', $item->getLink(), PHP_EOL;
echo 'Description : ', substr($item->getDescription(), 0, 40), PHP_EOL;
}