voniersa / sitemap-generator
A small PHP script that searches your website for links and generates a sitemap.xml file out of them.
1.0.0
2025-09-15 22:12 UTC
Requires
- php: ^8.2
- ext-dom: *
- guzzlehttp/guzzle: ^7.10
Requires (Dev)
- phpunit/phpunit: ^11.5
- slevomat/coding-standard: ^8.22
- squizlabs/php_codesniffer: ^3.13
README
A small PHP script that searches your website for links and generates a sitemap.xml file out of them.
Requirements
PHP Version 8.2 or higher
How to use
You can install the library with composer:
composer require voniersa/sitemap-generator
Execution
To execute the generator script simply execute the following command:
php vendor/voniersa/sitemap-generator/bin/sitemap-generator.php --base-url "URL_OF_YOUR_WEBSITE" --change-frequency "CHANGE_FREQUENCY_FOR_XML_SCHEMA" --ssl-verify "BOOLEAN" --output-dir "PATH_TO_YOUR_OUTPUT_DIRECTORY"
You need to replace the PLACEHOLDER_STRINGS in the command with your own values.
Explanation of the script arguments
argument name | description | default value |
---|---|---|
--base-url | The URL of your website from which a sitemap is to be created | https://localhost |
--change-frequency | The frequency with which the page is expected to change. This value provides general information to search engines. For more information. For more information and all valid values, see the documentation on sitemaps. | monthly |
--ssl-verify | Acknowledge SSL certificate errors. | false |
--output-dir | Path to the directory, where the generated sitemap.xml file is saved | ./ |
License
This library is released under the MIT Licence. See the bundled LICENSE file for details.
Author
Sascha Vonier (@voniersa)