cviebrock / laravel-news-sitemap
A simple Google News Sitemap generator for Laravel.
Installs: 4 910
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=5.4
- illuminate/http: ~4
- illuminate/support: ~4
- nesbot/carbon: ~1.0
Requires (Dev)
- orchestra/testbench: 2.2.*
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-11-05 18:59:35 UTC
README
A Google News sitemap generator for Laravel 4.
Installation
Add the package to your composer.json
file:
'cviebrock/laravel-news-sitemap' => 'dev-master'
Add the service provider to app/config/app.php
'providers' => array( ... 'Cviebrock\LaravelNewsSitemap\ServiceProvider', );
Publish the configuration file:
php artisan config:publish cviebrock/laravel-news-sitemap
Sample Usage
// 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.
- Fork the project.
- Create your bugfix/feature branch and write your (well-commented) code.
- Commit your changes and push to your repository.
- 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