{"id":17725502,"url":"https://github.com/webarchitect609/sitemap","last_synced_at":"2025-09-10T01:45:40.931Z","repository":{"id":62547379,"uuid":"140810665","full_name":"webarchitect609/sitemap","owner":"webarchitect609","description":"Generate sitemap.xml with respect to robots.txt disallow rules, according specification https://www.sitemaps.org and without dependencies from any framework or cms.","archived":false,"fork":false,"pushed_at":"2018-12-10T07:51:13.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T01:45:13.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webarchitect609.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-13T07:08:22.000Z","updated_at":"2018-12-10T07:47:02.000Z","dependencies_parsed_at":"2022-11-02T22:16:02.527Z","dependency_job_id":null,"html_url":"https://github.com/webarchitect609/sitemap","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/webarchitect609/sitemap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Fsitemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Fsitemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Fsitemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Fsitemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webarchitect609","download_url":"https://codeload.github.com/webarchitect609/sitemap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webarchitect609%2Fsitemap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262388436,"owners_count":23303318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-25T16:04:42.659Z","updated_at":"2025-06-28T06:36:16.686Z","avatar_url":"https://github.com/webarchitect609.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sitemap generation and deploy tool\n==================================\n\n**Be careful**: this version can be unstable and all interfaces can be changed in near future. \n\nFeatures\n--------\n\n- Respect of [Sitemaps XML format](https://www.sitemaps.org/protocol.html) and it's limits;\n- Sitemapindex is always supported;\n- Automatic setup 'lastmod' for sitemap in sitemapindex with the most fresh 'lastmod' from it's urls;\n- Automatic adding hostname for urls; \n- Respect of [robots.txt](https://developers.google.com/search/reference/robots_txt) `Disallow` rules for '*' agent to help you avoid undesired urls in your sitemap;\n- Write to a temporary folder and deploy to final destination to avoid damaging old copy in a case of troubles;\n- No dependencies from any framework;\n\nHow to use\n----------\n\n1 Install via [composer](https://getcomposer.org/)\n\n`composer require webarchitect609/sitemap`\n\n2 Create writer instance\n\n`$sitemapWriter = new \\WebArch\\Sitemap\\SitemapWriter('http://example.org', '/var/www/example.org/htdocs');`\n\n3 For simple usage just start to add urls directly to writer\n\n```\nuse WebArch\\Sitemap\\Enum\\ChangeFreq;\nuse WebArch\\Sitemap\\Model\\Url;\n\n$url1 = (new Url('/index.php'))-\u003ewithChangefreq(ChangeFreq::CHANGE_FREQ_DAILY)\n                               -\u003ewithPriority(0.9)\n                               -\u003ewithLastmod(\n                                   DateTimeImmutable::createFromFormat(\n                                       'Y-m-d H:i:s',\n                                       '2018-07-13 10:37:48'\n                                   )\n                               );\n\n$url2 = (new Url('/news/index.php'))-\u003ewithChangefreq(ChangeFreq::CHANGE_FREQ_HOURLY);\n\n$sitemapWriter-\u003eaddUrl($url1)\n              -\u003eaddUrl($url2);\n\n```\n\n4 For more complicated case you can create as many sitemaps as you need and give them to writer: \n\n```\n$newsSitemap = new \\WebArch\\Sitemap\\Model\\Sitemap('/sitemap_news.xml');\n\n$newsSitemap-\u003eaddUrl(\n                (new Url('/news/detail/1/'))\n            )\n            -\u003eaddUrl(\n                (new Url('/news/detail/2/'))\n            )\n            -\u003eaddUrl(\n                (new Url('/news/detail/3/'))\n            );\n\n$sitemapWriter-\u003eaddSitemap($newsSitemap);\n\n```\n\n5 Additional options can be applied to respect sitemap limitations\n\n```\n/**\n * Limit maximum urls count. When it's overflowed an `\\WebArch\\Sitemap\\Exception\\UrlCountLimitException` would be issued.\n * It's ON by default.\n */\n$newsSitemap-\u003egetUrlSet()-\u003ewithMaxUrlCount(50000);\n\n/**\n * Limit maximum file size\n * It's OFF by default.\n * WARNING: it WILL slow down everything: after adding new url estimated size calculations would be executed.\n * (Hope to get rid of this in the future)\n */\n$newsSitemap-\u003egetUrlSet()-\u003ewithMaxXmlSizeBytes(10*1024*1024);\n\n```\n\n6 And then just let it work \n\n```\n$sitemapWriter-\u003ewrite();\n```\n\nAfter this everything will be written to `sys_get_temp_dir()`. If there were no errors new version of sitemapindex + all \nsitemaps will be deployed to it's final destination at `$sitemapWriter-\u003egetBaseDir()` and file permissions will be \nchanged in a way to let everybody read them. \n\n\nRunning Unit-tests\n------------------\n`composer test`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebarchitect609%2Fsitemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebarchitect609%2Fsitemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebarchitect609%2Fsitemap/lists"}