-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from alexdebril/feature/factory
Factory class
- Loading branch information
Showing
16 changed files
with
816 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/* | ||
* This file is part of the feed-io package. | ||
* | ||
* (c) Alexandre Debril <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
require __DIR__.DIRECTORY_SEPARATOR.'bootstrap.php'; | ||
|
||
$feedIo = \FeedIo\Factory::create()->getFeedIo(); | ||
|
||
$result = $feedIo->read('http://php.net/feed.atom'); | ||
|
||
echo "feed title : {$result->getFeed()->getTitle()} \n "; | ||
|
||
foreach ($result->getFeed() as $item) { | ||
echo "item title : {$item->getTitle()} \n "; | ||
|
||
// let's turn php.net into a PodCast | ||
$media = new \FeedIo\Feed\Item\Media(); | ||
$media->setUrl('http://yourdomain.tld/medias/some-podcast.mp3'); | ||
$media->setType('audio/mpeg'); | ||
|
||
// add it to the item | ||
$item->addMedia($media); | ||
} | ||
|
||
$domDocument = $feedIo->toAtom($result->getFeed()); | ||
echo $domDocument->saveXML(); |
Oops, something went wrong.