Download the PHP package eko/feedbundle without Composer

On this page you can find all versions of the php package eko/feedbundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package feedbundle

FeedBundle

A Symfony bundle to build RSS/Atom feeds from entities

SensioLabsInsight

Build Status Latest Stable Version Total Downloads

Features

Installation

Add the package to your composer.json file

Add this to to the config/bundles.php file:

Configuration (only 3 quick steps!)

1) Create a file: config/packages/eko_feed.yml

The following configuration lines are required:

You can also set link as a Symfony route:

2) Implement the ItemInterface

Each entities you will use to generate an RSS feed needs to implement Eko\FeedBundle\Item\Writer\ItemInterface or Eko\FeedBundle\Item\Writer\RoutedItemInterface as demonstrated in this example for an Article entity of a blog:

Option A: Eko\FeedBundle\Item\Writer\ItemInterface

In this same entity, just implement those required methods:

Option B: Eko\FeedBundle\Item\Writer\RoutedItemInterface

Alternatively, if you need to make use of the router service to generate the link for your entity you can use the following interface. You don't need to worry about injecting the router to your entity.

In this entity, you'll need to implement the following methods:

3) Generate the feed!

The action now takes place in your controller. Just declare a new action with those examples lines:

Please note that for better performances you can add a cache control.

Moreover, entities objects can be added separately with add method:

Go further with your feeds

Add some custom channel fields

You can add custom fields to main channel by adding them this way:

Add some custom items fields

Add custom item fields

You can add custom items fields for your entities nodes by adding them this way:

Of course, getFeedItemCustom() method needs to be declared in your entity.

Add a group of custom item fields (optionally, with attributes)

You can also add group item fields using this way, if your method returns an array:

or even, multiple item fields in a group, like this:

or even, nested group item field in a group, like this:

Add a group of custom channel fields

As you can do for item fields, you can also add a custom group of channel fields like this:

Add custom media item fields

Media enclosure can be added using the MediaItemField field type as below:

The getFeedMediaItem() method must return an array with the following keys: type, length & value:

This media items can also be grouped using GroupItemField.

Dump your feeds by using the Symfony console command

You can dump your feeds into a .xml file if you don't want to generate it on the fly by using the php app/console eko:feed:dump Symfony command.

Here are the options :

Option Description
--name Feed name defined in eko_feed configuration
--entity Entity to use to generate the feed
--filename Defines feed filename
--orderBy Order field to sort by using findBy() method
--direction Direction to give to sort field with findBy() method
--format Formatter to use to generate, "rss" is default
--limit Defines a limit of entity items to retrieve
Host Defines the host base to generate absolute Url

An example with all the options:

php app/console eko:feed:dump --name=article --entity=AcmeDemoBundle:Fake --filename=test.xml --format=atom --orderBy=id --direction=DESC www.myhost.com

This will result:

Dump your feeds by using the Eko\FeedBundle\Service\FeedDumpService

You can dump your feeds by simply using the "Eko\FeedBundle\Service\FeedDumpService" service. Used by the dump command, you have the same value to set. If you already have you items feed ready, you can dump it using the setItems().

For any question, do not hesitate to contact me and/or participate.

Read an XML feed and populate an entity

If you only want to read an XML feed, here is the way:

$feed will be a \Zend\Feed\Reader\Feed\FeedInterface that you can manipulate.


You can also populate an entity from an XML feed. This is very easy.

Just load the feed and call the populate method with your entity name which needs to implement Eko\FeedBundle\Item\Reader\ItemInterface, take a look on this example:

In this example, $items will be an array that will contains an array with your entities populated with the given feed content.

Use a custom hydrator to populate your entity

You can also write your own hydrator and use it this way:

This way, your custom hydrator will be used instead of the Eko\FeedBundle\Hydrator\DefaultHydrator

Define a custom feed formatter

You can define your own feed formatter by using the following tag:

Then, use it by simply calling $feed->render('custom').

Contributors


All versions of feedbundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
symfony/framework-bundle Version ^4.4|^5.3|^6.0|^7.0
symfony/translation Version ^4.4|^5.3|^6.0|^7.0
laminas/laminas-feed Version ^2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eko/feedbundle contains the following files

Loading the files please wait ....