New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

hyancat/larss

RSS builder for Laravel 5
563 3
Install
composer require hyancat/larss
Latest Version:v1.4
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Oct 30, 2016
Links: GitHub  ·  Packagist
Maintainer: HyanCat

larss

RSS builder for Laravel 5

Installation

  1. Pull down the package with composer:

     composer require hyancat/larss
    
  2. Add the service provider to your providers array in app/config/app.php file.

     'Hyancat\Larss\LarssServiceProvider'
    
  3. At last, add the alias to the alias array in app/config/app.php file.

     'RSS'		=> 'Hyancat\Larss\LarssFacade',
    

Usage

Usage with Cache:


$rss = \RSS::make();
if (! $rss->caching(10)) {

	// make channel.
	$rss->channel([
		'title'       => 'title',
		'description' => 'description',
		'link'        => 'http://www.xxx.yyy',
	])->withImage([
		'url'   => 'http://www.xxx.yyy/logo.png',
	  	'title' => 'title',
	  	'link'  => 'http://www.xxx.yyy',
	]);

	// gen posts data ......
	foreach ($posts as $post) {
		$rss->item([
			'title'             => $post->title,
			'description|cdata' => $post->body,
			'link'              => $post->url,
			// ......
		]);
	}
}

// If you want to save the rss data to file.
$rss->save('rss.xml');

// Or just make a response to the http request.
return \Response::make($rss->render(), 200, ['Content-Type' => 'text/xml']);

Usage without Cache:


// make with channel.
$rss = \RSS::make()->channel([
	'title'       => 'title',
	'description' => 'description',
	'link'        => 'http://www.xxx.yyy',
	// ......
])->withImage([
	'url'   => 'http://www.xxx.yyy/logo.png',
	'title' => 'title',
	'link'  => 'http://www.xxx.yyy',
]);

// gen posts data ......
foreach ($posts as $post) {
	$rss->item([
		'title'             => $post->title,
		'description|cdata' => $post->body,
		'link'              => $post->url,
		// ......
	]);
}

return ...;

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

665,354,487 9,703
laravel/framework

The Laravel Framework.

633,434,998 35,124
laravel/tinker

Powerful REPL for the Laravel framework.

539,265,140 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

458,029,405 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

424,642,029 4,662

Version History

Version Released PHP Laravel License
v1.4 >=5.4.0 ~5.0 MIT
v1.3 >=5.4.0 ~5.0 MIT
v1.2 >=5.4.0 5.0.* MIT
v1.1 >=5.4.0 5.0.* MIT
v1.0 >=5.4.0 5.0.* MIT