Download the PHP package otas/sitemap without Composer

On this page you can find all versions of the php package otas/sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sitemap

Otas Sitemap

A Laravel package to generate multilingual XML sitemaps with support for static pages, dynamic model-based URLs, translated slugs, and multi-segment path templates.


Table of Contents


Requirements


Installation

Run the setup command to publish the configuration file:

Or publish the config manually:


Configuration

After publishing, the configuration file is located at config/sitemap.php.

Note: The package also reads config('translatable.locales') to determine which locales to generate URLs for. Make sure this is configured in your application (e.g. via the astrotomic/laravel-translatable package).


Static Links

Define static pages directly in the config file. Each entry specifies its location, alternate locale variants, and priority.


Dynamic Links

Dynamic links are generated from Eloquent model records. Register your models in the config:

The SitemapContract

Every model must implement Otas\Sitemap\Contracts\SitemapContract:

Path Template Placeholders

The sitemapTranslatedSegments() method returns a path template per locale. Templates use :placeholder syntax for dynamic parts:

Reserved placeholder:

Placeholder Resolved by
:modelIdentifier Automatically resolved from the translations table (buildLocalizedUrls only). For buildDefaultUrls, you must provide it via slugResolver.

Custom placeholders (:categorySlug, :brandSlug, etc.) are resolved via the $slugResolver callback:

The $slugResolver receives only the model item and returns a flat [':placeholder' => 'value'] map. No locale logic is needed inside it — the locale-specific path structure is already defined in the template.


Non-Translated Slugs (buildDefaultUrls)

Use this when the model's slug is the same across all locales (e.g. offers, products). Since the slug is the same, there's no automatic resolution of :modelIdentifier. You must provide ALL placeholders in the slugResolver.

Simple example — single segment:

Generated URLs for an offer with slug summer-sale:


Translated Slugs (buildLocalizedUrls)

Use this when the model's slug is different per locale (e.g. blog posts with translated titles/slugs).

The :modelIdentifier placeholder is automatically resolved to the translated value for each locale from the model's translations table.

Simple example — single segment:

Generated URLs for a blog with EN slug laravel-tips and AR slug نصائح-لارافل:


Multi-Segment URLs

For URLs with multiple dynamic parts, add custom placeholders to the template and provide a slugResolver.

Example: Offer with Category (non-translated)

URL structure: offers/{category}/{offer-slug}

Generated URLs for offer summer-sale in category electronics:

Example: Blog with Category (translated)

URL structure: blogs/{category}/{post-slug}

Generated URLs for blog with EN slug laravel-tips, AR slug نصائح-لارافل, in category tech:

Example: Product with Brand + Category (three levels)

URL structure: shop/{brand}/{category}/{product-slug}

Generated URLs for product macbook-pro, brand apple, category laptops:


Generating the Sitemap

Generate the sitemap XML file using the Artisan command:

The file is saved to the public disk at the path configured in sitemap.base_path + sitemaps/sitemap.xml. If a subdomain is configured, the filename becomes {subdomain}-sitemap.xml.

You can schedule this command in your app/Console/Kernel.php:


Serving the Sitemap

When load_routes is true (default), the package registers a route that serves the generated sitemap:

The route prefix is controlled by package_routes_prefix in the config.

To publish and customize the route file:

This copies the route file to your application's routes/ directory for full control.


Artisan Commands

Command Description
php artisan setup:sitemap Publish the config file (with overwrite prompt if it already exists)
php artisan app:generate-sitemap Generate the sitemap XML and save it to the public disk
php artisan sitemap:publish-routes Publish the package route file to your application's routes/ directory

Full Examples

Minimal Setup (Single Model, No Translations)

1. Config:

2. Model:

3. Generate:

Complete Setup (Static + Multiple Dynamic Models)

Config:

Models:


Generated XML Output

The generated sitemap follows the Sitemaps XML protocol with xhtml:link alternate tags for multilingual support:


License

Otas Sitemap is open-sourced software licensed under the MIT license.


All versions of sitemap with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version >=9.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package otas/sitemap contains the following files

Loading the files please wait ...