Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dgtlss/columbus
Columbus is a lightweight composer package that allows you to quickly and easily generate sitemaps for your laravel application.
https://github.com/dgtlss/columbus
Last synced: 6 days ago
JSON representation
Columbus is a lightweight composer package that allows you to quickly and easily generate sitemaps for your laravel application.
- Host: GitHub
- URL: https://github.com/dgtlss/columbus
- Owner: dgtlss
- License: apache-2.0
- Created: 2023-09-20T22:21:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-25T15:32:48.000Z (over 1 year ago)
- Last Synced: 2025-01-13T01:36:33.469Z (11 days ago)
- Language: PHP
- Homepage:
- Size: 2.07 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 🧠Columbus
![Columbus OG Image](columbus_og.png)
Columbus is a lightweight composer package that allows you to quickly and easily generate sitemaps for your Laravel application.## Installation
You can install the package via composer:
```
composer require dgtlss/columbus
```Once installed you can publish the config file and generate the middleware required for Columbus to work. The middleware tells Columbus which routes should be added to the sitemap, and which should be ignored.
```
php artisan columbus:init
```Once you have initialised Columbus you will need to add the middleware to your `app/Http/Kernel.php` file. You can do this by adding the following line to the `$routeMiddleware` array:
```
'Mappable' => \App\Http\Middleware\Mappable::class,
```Now that the middleware has been added to your laravel application you can generate your sitemap by running the following command:
```
php artisan columbus:map
```This will generate a `sitemap.xml` file in your public directory. This will now be available by going to `yourdomain.test/sitemap`
## Usage
Now that we have successfully installed and configured Columbus you can start adding routes to your sitemap. You can do this by adding the `Mappable` middleware to the routes that you want to be included in the `sitemap.xml` file. When Columbus initialised it added a premade route group & middleware to your `routes/web.php` file. You can add routes to this group like so:
```
Route::middleware(['Mappable'])->group(function(){
/* routes in this group will be added to the sitemap */
Route::get('/', function () {
return view('welcome');
})->name('home');
});```
### Notes
- By default Columbus will only add `GET` routes to your sitemap. If you want to change this you can do so inside of `config/columbus.php`
- *Please note: Routes with variables currently do not work with Columbus. This is something that will be added in the future.*