laravel-news-sitemap
所属分类:搜索引擎
开发工具:PHP
文件大小:9KB
下载次数:0
上传日期:2014-10-07 18:43:04
上 传 者:
sh-1993
说明: Laravel 4的谷歌新闻网站地图生成器。
(A Google News sitemap generator for Laravel 4.)
文件列表:
.semver (47, 2014-10-08)
.travis.yml (252, 2014-10-08)
CHANGELOG.md (275, 2014-10-08)
LICENSE (1082, 2014-10-08)
TODO.md (104, 2014-10-08)
composer.json (604, 2014-10-08)
phpunit.xml (569, 2014-10-08)
src (0, 2014-10-08)
src\Cviebrock (0, 2014-10-08)
src\Cviebrock\LaravelNewsSitemap (0, 2014-10-08)
src\Cviebrock\LaravelNewsSitemap\NewsSitemap.php (3218, 2014-10-08)
src\Cviebrock\LaravelNewsSitemap\ServiceProvider.php (1166, 2014-10-08)
src\config (0, 2014-10-08)
src\config\config.php (296, 2014-10-08)
src\views (0, 2014-10-08)
src\views\xml.blade.php (1727, 2014-10-08)
tests (0, 2014-10-08)
tests\NewsSitemapTest.php (1871, 2014-10-08)
# laravel-news-sitemap
A Google News sitemap generator for Laravel 4.
[![Build Status](https://travis-ci.org/cviebrock/eloquent-sluggable.svg)](https://travis-ci.org/cviebrock/laravel-news-sitemap)
[![Total Downloads](https://poser.pugx.org/cviebrock/laravel-news-sitemap/downloads.png)](https://packagist.org/packages/cviebrock/laravel-news-sitemap)
[![Latest Stable Version](https://poser.pugx.org/cviebrock/laravel-news-sitemap/v/stable.png)](https://packagist.org/packages/cviebrock/laravel-news-sitemap)
## Installation
Add the package to your `composer.json` file:
```
'cviebrock/laravel-news-sitemap' => 'dev-master'
```
Add the service provider to `app/config/app.php`
```php
'providers' => array(
...
'Cviebrock\LaravelNewsSitemap\ServiceProvider',
);
```
Publish the configuration file:
```sh
php artisan config:publish cviebrock/laravel-news-sitemap
```
## Sample Usage
```php
// create a new sitemap instance
$sitemap = \App::make('Cviebrock\LaravelNewsSitemap\NewsSitemap');
// if it's not cached, then populate with entries
if (!$sitemap->isCached()) {
foreach (Posts::all() as $post) {
$extras = [];
$images = [];
foreach ($post->images as $image) {
$images[] = [
'loc' => $image->url,
'caption' => $image->caption
];
}
$extras['keywords'] = $post->topics->lists('name');
$this->sitemap->addEntry($post->url, $post->title, $post->published_at, $extras, $images);
}
}
// returns an XML response
return $sitemap->render();
```
## Bugs, Suggestions and Contributions
Please use Github for bugs, comments, suggestions.
1. Fork the project.
2. Create your bugfix/feature branch and write your (well-commented) code.
3. Commit your changes and push to your repository.
4. Create a new pull request against this project's `master` branch.
## Copyright and License
**laravel-news-sitemap** was written by Colin Viebrock and released under the MIT License. See the LICENSE file for details.
Copyright 2014 Colin Viebrock
近期下载者:
相关文件:
收藏者: