Looking to hire Laravel developers? Try LaraJobs

optimax-laravel maintained by devlixar

Description
Generate XML sitemaps for your Laravel site with the Optimax API by Devlixar.
Last update
2026/11/28 11:31 (dev-main)
License
Downloads
3

Comments
comments powered by Disqus

Optimax for Laravel

Generate your XML sitemap with Optimax and save it as public/sitemap.xml, from the command line, on a schedule, or from your admin panel with the Vue component.

Full guide: https://optimax.devlixar.com/developers

Requirements

  • PHP 8.1+, Laravel 10, 11, 12 or 13
  • An Optimax API key (Pro or Premium plan): Dashboard → API keys. Each key works for one website (www and non-www are the same site); create one key per website.

Install

composer require devlixar/optimax-laravel

.env:

OPTIMAX_API_KEY=your-api-key-here
OPTIMAX_SITE_URL=https://your-site.com   # the website this key was created for

Check the key (it also warns if OPTIMAX_SITE_URL is not the key's website):

php artisan optimax:sitemap --check

Generate

php artisan optimax:sitemap             # crawl, wait, save public/sitemap.xml
php artisan optimax:sitemap --no-wait   # start and return
php artisan optimax:sitemap --resume    # wait for the last crawl and save it

Schedule

Laravel 11, 12 and 13, routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('optimax:sitemap')->weeklyOn(1, '3:00')->withoutOverlapping()->runInBackground();

Laravel 10, app/Console/Kernel.php:

$schedule->command('optimax:sitemap')->weeklyOn(1, '3:00')->withoutOverlapping()->runInBackground();

Routes for the Vue component

The package adds two JSON routes for @devlixar/optimax-vue:

Route
GET {prefix}/status latest crawl and progress; saves the file when it finishes
POST {prefix}/generate starts a crawl

Publish the config and put them behind your admin login:

php artisan vendor:publish --tag=optimax-config
'routes' => [
    'enabled'    => true,
    'prefix'     => 'admin-api/optimax',
    'middleware' => ['api', 'auth:sanctum'],
],

From code

use Devlixar\Optimax\Facades\Optimax;

Optimax::generate();          // start a crawl
$state = Optimax::refresh();  // progress; saves the file once finished
$me = Optimax::client()->me();

The API key stays on your server. It is never sent to the browser.

MIT licence.