{"id":15025580,"url":"https://github.com/melbahja/seo","last_synced_at":"2025-05-16T14:09:22.583Z","repository":{"id":34245166,"uuid":"173450155","full_name":"melbahja/seo","owner":"melbahja","description":"🐘 Simple PHP library to help developers 🍻 do better on-page SEO optimization 🤖","archived":false,"fork":false,"pushed_at":"2022-09-11T11:22:38.000Z","size":69,"stargazers_count":328,"open_issues_count":2,"forks_count":51,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-15T09:21:40.827Z","etag":null,"topics":["hacktoberfest","metatags","php","php71","php8","php80","php81","schema-org","search-engine-optimization","seo","seo-meta","seo-metadata","seo-optimization","seo-tools","seotools","sitemap","sitemap-builder","sitemap-generator","sitemap-xml"],"latest_commit_sha":null,"homepage":"https://git.io/phpseo","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melbahja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-02T13:18:29.000Z","updated_at":"2025-05-09T08:07:27.000Z","dependencies_parsed_at":"2022-08-08T00:02:23.045Z","dependency_job_id":null,"html_url":"https://github.com/melbahja/seo","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2Fseo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2Fseo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2Fseo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melbahja%2Fseo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melbahja","download_url":"https://codeload.github.com/melbahja/seo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254544158,"owners_count":22088808,"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":["hacktoberfest","metatags","php","php71","php8","php80","php81","schema-org","search-engine-optimization","seo","seo-meta","seo-metadata","seo-optimization","seo-tools","seotools","sitemap","sitemap-builder","sitemap-generator","sitemap-xml"],"created_at":"2024-09-24T20:02:37.438Z","updated_at":"2025-05-16T14:09:22.538Z","avatar_url":"https://github.com/melbahja.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# PHP SEO \n[![Build Status](https://github.com/melbahja/seo/workflows/Test/badge.svg)](https://github.com/melbahja/seo/actions?query=workflow%3ATest) [![GitHub license](https://img.shields.io/github/license/melbahja/seo)](https://github.com/melbahja/seo/blob/master/LICENSE) ![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/melbahja/seo) ![Packagist Version](https://img.shields.io/packagist/v/melbahja/seo) [![Twitter](https://img.shields.io/twitter/url/https/github.com/melbahja/seo.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fmelbahja%2Fseo)\n\nSimple PHP library to help developers 🍻 do better on-page SEO optimization\n\n### PHP SEO features:\n\n- [[👷]](#-generate-schemaorg) **Generate schema.org ld+json**\n- [[🛀]](#-meta-tags) **Generate meta tags with twitter and open graph support**\n- [[🌐]](#-sitemaps) **Generate sitemaps xml and indexes (supports: 🖺 news, 🖼 images, 📽 videos)**\n- [[📤]](#-send-sitemaps-to-search-engines) **Submit new sitemaps to search engines**\n- [[📤]](#-indexing-api) **Indexing API**\n- [[🙈]](https://github.com/melbahja/seo/blob/master/composer.json) **No dependencies**\n\n## Installation:\n```bash\ncomposer require melbahja/seo\n```\n\n## Usage:\nCheck this simple examples. (of course the composer autoload.php file is required)\n\n\n#### 👷 Generate schema.org\n```php\nuse Melbahja\\Seo\\Schema;\nuse Melbahja\\Seo\\Schema\\Thing;\n\n$schema = new Schema(\n    new Thing('Organization', [\n        'url'          =\u003e 'https://example.com',\n        'logo'         =\u003e 'https://example.com/logo.png',\n        'contactPoint' =\u003e new Thing('ContactPoint', [\n            'telephone' =\u003e '+1-000-555-1212',\n            'contactType' =\u003e 'customer service'\n        ])\n    ])\n);\n\necho $schema;\n```\n\n**Results:** (formatted)\n```html\n\u003cscript type=\"application/ld+json\"\u003e\n{\n  \"@context\": \"https://schema.org\",\n  \"@graph\": [\n    {\n      \"url\": \"https://example.com\",\n      \"logo\": \"https://example.com/logo.png\",\n      \"contactPoint\": {\n        \"telephone\": \"+1-000-555-1212\",\n        \"contactType\": \"customer service\",\n        \"@type\": \"ContactPoint\",\n        \"@context\": \"https://schema.org/\"\n      },\n      \"@type\": \"Organization\",\n      \"@context\": \"https://schema.org/\"\n    }\n  ]\n}\n\u003c/script\u003e\n```\n\n```php\nuse Melbahja\\Seo\\Schema;\nuse Melbahja\\Seo\\Schema\\Thing;\n\n$product = new Thing('Product');\n$product-\u003ename  = \"Foo Bar\";\n$product-\u003esku   = \"sk12\";\n$product-\u003eimage = \"/image.jpeg\";\n$product-\u003edescription = \"testing\";\n$product-\u003eoffers = new Thing('Offer', [\n    'availability' =\u003e 'https://schema.org/InStock',\n    'priceCurrency' =\u003e 'USD',\n    \"price\" =\u003e \"119.99\",\n    'url' =\u003e 'https://gool.com',\n]);\n\n$webpage = new Thing(\"WebPage\", [\n    '@id' =\u003e \"https://example.com/product/#webpage\",\n    'url' =\u003e \"https://example.com/product\",\n    'name' =\u003e 'Foo Bar',\n]);\n\n\n$schema = new Schema(\n    $product,\n    $webpage,\n);\n\necho json_encode($schema, JSON_PRETTY_PRINT);\n```\n**Results:**\n```json\n{\n  \"@context\": \"https://schema.org\",\n  \"@graph\": [\n    {\n      \"name\": \"Foo Bar\",\n      \"sku\": \"sk12\",\n      \"image\": \"/image.jpeg\",\n      \"description\": \"testing\",\n      \"offers\": {\n        \"availability\": \"https://schema.org/InStock\",\n        \"priceCurrency\": \"USD\",\n        \"price\": \"119.99\",\n        \"url\": \"https://gool.com\",\n        \"@type\": \"Offer\",\n        \"@context\": \"https://schema.org/\"\n      },\n      \"@type\": \"Product\",\n      \"@context\": \"https://schema.org/\"\n    },\n    {\n      \"@id\": \"https://example.com/product/#webpage\",\n      \"url\": \"https://example.com/product\",\n      \"name\": \"Foo Bar\",\n      \"@type\": \"WebPage\",\n      \"@context\": \"https://schema.org/\"\n    }\n  ]\n}\n```\n\n#### 🛀 Meta Tags\n\n```php\nuse Melbahja\\Seo\\MetaTags;\n\n$metatags = new MetaTags();\n\n$metatags\n        -\u003etitle('PHP SEO')\n        -\u003edescription('This is my description')\n        -\u003emeta('author', 'Mohamed Elabhja')\n        -\u003eimage('https://avatars3.githubusercontent.com/u/8259014')\n        -\u003emobile('https://m.example.com')\n        -\u003ecanonical('https://example.com')\n        -\u003eshortlink('https://git.io/phpseo')\n        -\u003eamp('https://apm.example.com');\n\necho $metatags;\n\n```\n\n**Results:**\n```html\n\u003ctitle\u003ePHP SEO\u003c/title\u003e\n\u003cmeta name=\"title\" content=\"PHP SEO\" /\u003e\n\u003cmeta name=\"description\" content=\"This is my description\" /\u003e\n\u003cmeta name=\"author\" content=\"Mohamed Elabhja\" /\u003e\n\u003clink href=\"https://m.example.com\" rel=\"alternate\" media=\"only screen and (max-width: 640px)\" /\u003e\n\u003clink rel=\"canonical\" href=\"https://example.com\" /\u003e\n\u003clink rel=\"shortlink\" href=\"https://git.io/phpseo\" /\u003e\n\u003clink rel=\"amphtml\" href=\"https://apm.example.com\" /\u003e\n\u003cmeta property=\"twitter:title\" content=\"PHP SEO\" /\u003e\n\u003cmeta property=\"twitter:description\" content=\"This is my description\" /\u003e\n\u003cmeta property=\"twitter:card\" content=\"summary_large_image\" /\u003e\n\u003cmeta property=\"twitter:image\" content=\"https://avatars3.githubusercontent.com/u/8259014\" /\u003e\n\u003cmeta property=\"og:title\" content=\"PHP SEO\" /\u003e\n\u003cmeta property=\"og:description\" content=\"This is my description\" /\u003e\n\u003cmeta property=\"og:image\" content=\"https://avatars3.githubusercontent.com/u/8259014\" /\u003e\n```\n\n\n#### 🗺 Sitemaps\n```php\n$yourmap = new Sitemap(string $url, array $options = []): SitemapIndexInterface\n```\n| Option name   | Description                                       | Required ?    | Default       |\n| ------------- | -------------                                     | ---------     | --------      |\n| save_path     | Generated sitemaps storage path                   | YES           |               |\n| sitemaps_url  | Sitemap index custom url for generated sitemaps   | NO            | $url          |\n| index_name    | Custom sitemap index name                         | NO            | sitemap.xml   |\n\n##### Simple Example\n```php\nuse Melbahja\\Seo\\Sitemap;\n\n$sitemap = new Sitemap('https://example.com', ['save_path' =\u003e '/path/to_save/files']);\n\n$sitemap-\u003elinks('blog.xml', function($map)\n{\n    $map-\u003eloc('/blog')-\u003efreq('daily')-\u003epriority('0.8')\n        -\u003eloc('/blog/my-new-article')-\u003efreq('weekly')-\u003elastMod('2019-03-01')\n        -\u003eloc('/اهلا-بالعالم')-\u003efreq('weekly');\n    $map-\u003eloc('/blog/hello')-\u003efreq('monthly');\n});\n\n// return bool\n// throws SitemapException if save_path options not exists\n$sitemap-\u003esave();\n```\n\n**Results:** (📂 in: /path/to_save/files/)\n\n📁: sitemap.xml (formatted)\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003csitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003csitemap\u003e\n        \u003cloc\u003ehttps://example.com/blog.xml\u003c/loc\u003e\n        \u003clastmod\u003e2019-03-01T14:38:02+01:00\u003c/lastmod\u003e\n    \u003c/sitemap\u003e\n\u003c/sitemapindex\u003e\n```\n\n📁: blog.xml (formatted)\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003curl\u003e\n      \u003cloc\u003ehttps://example.com/blog\u003c/loc\u003e\n      \u003cchangefreq\u003edaily\u003c/changefreq\u003e\n      \u003cpriority\u003e0.8\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n      \u003cloc\u003ehttps://example.com/blog/my-new-article\u003c/loc\u003e\n      \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n      \u003clastmod\u003e2019-03-01T00:00:00+01:00\u003c/lastmod\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n      \u003cloc\u003ehttps://example.com/%D8%A7%D9%87%D9%84%D8%A7-%D8%A8%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85\u003c/loc\u003e\n      \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n      \u003cloc\u003ehttps://example.com/blog/hello\u003c/loc\u003e\n      \u003cchangefreq\u003emonthly\u003c/changefreq\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\n##### Multipe Sitemaps \u0026\u0026 Images\n```php\nuse Melbahja\\Seo\\Sitemap;\n\n$sitemap = new Sitemap('https://example.com');\n\n// Instead of passing save_path to the factory you can set it later via setSavePath\n// also $sitemap-\u003egetSavePath() method to get the current save_path\n$sitemap-\u003esetSavePath('your_save/path');\n\n// changing sitemap index name\n$sitemap-\u003esetIndexName('index.xml');\n\n// For images you need to pass a option images =\u003e true\n$sitemap-\u003elinks(['name' =\u003e 'blog.xml', 'images' =\u003e true], function($map)\n{\n    $map-\u003eloc('/blog')-\u003efreq('daily')-\u003epriority('0.8')\n        -\u003eloc('/blog/my-new-article')\n            -\u003efreq('weekly')\n            -\u003elastMod('2019-03-01')\n            -\u003eimage('/uploads/image.jpeg', ['caption' =\u003e 'My caption'])\n        -\u003eloc('/اهلا-بالعالم')-\u003efreq('weekly');\n\n    // image(string $url, array $options = []), image options: caption, geo_location, title, license\n    // see References -\u003e images\n    $map-\u003eloc('/blog/hello')-\u003efreq('monthly')-\u003eimage('https://cdn.example.com/image.jpeg');\n});\n\n// another file\n$sitemap-\u003elinks('blog_2.xml', function($map)\n{\n    // Mabye you need to loop through posts form your database ?\n    foreach (range(0, 4) as $i)\n    {\n        $map-\u003eloc(\"/posts/{$i}\")-\u003efreq('weekly')-\u003epriority('0.7');\n    }\n});\n\n$sitemap-\u003esave();\n\n```\n\n**Results**\n\n📁: index.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003csitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003csitemap\u003e\n        \u003cloc\u003ehttps://example.com/blog.xml\u003c/loc\u003e\n        \u003clastmod\u003e2019-03-01T15:13:22+01:00\u003c/lastmod\u003e\n    \u003c/sitemap\u003e\n    \u003csitemap\u003e\n        \u003cloc\u003ehttps://example.com/blog_2.xml\u003c/loc\u003e\n        \u003clastmod\u003e2019-03-01T15:13:22+01:00\u003c/lastmod\u003e\n    \u003c/sitemap\u003e\n\u003c/sitemapindex\u003e\n\n```\n\n📁: blog.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003curlset\n    xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n    xmlns:image=\"http://www.google.com/schemas/sitemap-image/1.1\"\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/blog\u003c/loc\u003e\n        \u003cchangefreq\u003edaily\u003c/changefreq\u003e\n        \u003cpriority\u003e0.8\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/blog/my-new-article\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003clastmod\u003e2019-03-01T00:00:00+01:00\u003c/lastmod\u003e\n        \u003cimage:image\u003e\n            \u003cimage:caption\u003eMy caption\u003c/image:caption\u003e\n            \u003cimage:loc\u003ehttps://example.com/uploads/image.jpeg\u003c/image:loc\u003e\n        \u003c/image:image\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/%D8%A7%D9%87%D9%84%D8%A7-%D8%A8%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/blog/hello\u003c/loc\u003e\n        \u003cchangefreq\u003emonthly\u003c/changefreq\u003e\n        \u003cimage:image\u003e\n            \u003cimage:loc\u003ehttps://cdn.example.com/image.jpeg\u003c/image:loc\u003e\n        \u003c/image:image\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\n📁: blog_2.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003curlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/0\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003cpriority\u003e0.7\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/1\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003cpriority\u003e0.7\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/2\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003cpriority\u003e0.7\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/3\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003cpriority\u003e0.7\u003c/priority\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/4\u003c/loc\u003e\n        \u003cchangefreq\u003eweekly\u003c/changefreq\u003e\n        \u003cpriority\u003e0.7\u003c/priority\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\n##### Sitemap with videos\n```php\n$sitemap = (new Sitemap('https://example.com'))\n                -\u003esetSavePath('./storage/sitemaps')\n                -\u003esetSitemapsUrl('https://example.com/sitemaps')\n                -\u003esetIndexName('index.xml');\n\n$sitemap-\u003elinks(['name' =\u003e 'posts.xml', 'videos' =\u003e true], function($map)\n{\n    $map-\u003eloc('/posts/clickbait-video')-\u003evideo('My Clickbait Video title',\n    [\n        // or thumbnail_loc\n        'thumbnail' =\u003e 'https://example.com/thumbnail.jpeg',\n        'description' =\u003e 'My description',\n        // player_loc or content_loc one of them is required\n        'player_loc' =\u003e 'https://example.com/embed/81287127'\n\n        // for all available options see References -\u003e videos\n    ]);\n\n    $map-\u003eloc('posts/bla-bla');\n});\n\n$sitemap-\u003esave();\n```\n**Results**\n\n📁: index.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003csitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003csitemap\u003e\n        \u003cloc\u003ehttps://example.com/sitemaps/posts.xml\u003c/loc\u003e\n        \u003clastmod\u003e2019-03-01T15:30:02+01:00\u003c/lastmod\u003e\n    \u003c/sitemap\u003e\n\u003c/sitemapindex\u003e\n```\n**Note:** lastmod in sitemap index files are generated automatically\n\n📁: posts.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003curlset\n    xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n    xmlns:video=\"http://www.google.com/schemas/sitemap-video/1.1\"\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/clickbait-video\u003c/loc\u003e\n        \u003cvideo:video\u003e\n            \u003cvideo:description\u003eMy description\u003c/video:description\u003e\n            \u003cvideo:player_loc\u003ehttps://example.com/embed/81287127\u003c/video:player_loc\u003e\n            \u003cvideo:title\u003eMy Clickbait Video title\u003c/video:title\u003e\n            \u003cvideo:thumbnail_loc\u003ehttps://example.com/thumbnail.jpeg\u003c/video:thumbnail_loc\u003e\n        \u003c/video:video\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/posts/bla-bla\u003c/loc\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\n##### News Sitemaps\n\n```php\nuse Melbahja\\Seo\\Factory;\n\n$sitemap = Factory::sitemap('https://example.com',\n[\n    // You can also customize your options by passing array to the factory like this\n    'save_path' =\u003e './path',\n    'sitemaps_url' =\u003e 'https://example.com/maps',\n    'index_name' =\u003e 'news_index.xml'\n]);\n\n$sitemap-\u003enews('my_news.xml', function($map)\n{\n    // publication: name, language\n    // Google quote about the name: \"It must exactly match the name as\n    // it appears on your articles on news.google.com\"\n    $map-\u003esetPublication('PHP NEWS', 'en');\n\n    $map-\u003eloc('/news/12')-\u003enews(\n    [\n       'title' =\u003e 'PHP 8 Released',\n       'publication_date' =\u003e '2019-03-01T15:30:02+01:00',\n    ]);\n\n    $map-\u003eloc('/news/13')-\u003enews(\n    [\n        'title' =\u003e 'PHP 8 And High Performance',\n        'publication_date' =\u003e '2019-04-01T15:30:02+01:00'\n    ]);\n});\n\n$sitemap-\u003esave();\n```\n\n**Results**\n\n📁: news_index.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003csitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\u003e\n    \u003csitemap\u003e\n        \u003cloc\u003ehttps://example.com/maps/my_news.xml\u003c/loc\u003e\n        \u003clastmod\u003e2019-03-01T15:57:10+01:00\u003c/lastmod\u003e\n    \u003c/sitemap\u003e\n\u003c/sitemapindex\u003e\n```\n\n📁: my_news.xml\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!-- Generated by https://git.io/phpseo --\u003e\n\u003curlset\n    xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\n    xmlns:news=\"https://www.google.com/schemas/sitemap-news/0.9\"\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/news/12\u003c/loc\u003e\n        \u003cnews:news\u003e\n            \u003cnews:publication\u003e\n                \u003cnews:name\u003ePHP NEWS\u003c/news:name\u003e\n                \u003cnews:language\u003een\u003c/news:language\u003e\n            \u003c/news:publication\u003e\n            \u003cnews:title\u003ePHP 8 Released\u003c/news:title\u003e\n            \u003cnews:publication_date\u003e2019-03-01T15:30:02+01:00\u003c/news:publication_date\u003e\n        \u003c/news:news\u003e\n    \u003c/url\u003e\n    \u003curl\u003e\n        \u003cloc\u003ehttps://example.com/news/13\u003c/loc\u003e\n        \u003cnews:news\u003e\n            \u003cnews:publication\u003e\n                \u003cnews:name\u003ePHP NEWS\u003c/news:name\u003e\n                \u003cnews:language\u003een\u003c/news:language\u003e\n            \u003c/news:publication\u003e\n            \u003cnews:title\u003ePHP 8 And High Performance\u003c/news:title\u003e\n            \u003cnews:publication_date\u003e2019-04-01T15:30:02+01:00\u003c/news:publication_date\u003e\n        \u003c/news:news\u003e\n    \u003c/url\u003e\n\u003c/urlset\u003e\n```\n\n**Google quote:** ⚠ \"If you submit your News sitemap before your site has been reviewed and approved by our team, you may receive errors.\" ⚠\n\n\n#### 🤖 Send Sitemaps To Search Engines\n\nAccording to the sitemaps protocol, search engines should have a url that allow you to inform them about your new sitemap files. like: \u003csearchengine_URL\u003e/ping?sitemap=sitemap_url\n\n```php\nuse Melbahja\\Seo\\Ping;\n\n$ping = new Ping;\n\n// the void method send() will inform via CURL: google, bing and yandex about your new file\n$ping-\u003esend('https://example.com/sitemap_file.xml');\n\n```\n\n### Indexing API\n\nThis is the first PHP library to support the new search engines indexing API (aka indexnow.org).\n\n```php\nuse Melbahja\\Seo\\Indexing;\n\n$indexer = new Indexing('www.example.cpm', [\n    'bing.com' =\u003e 'your_api_key_here',\n    'yandex.com' =\u003e 'your_api_key_here',\n]);\n\n\n// index single url.\n$indexer-\u003eindexUrl('https://www.example.com/page');\n\n// index multi urls.\n$indexer-\u003eindexUrls(['https://www.example.com/page']);\n\n```\n\n## Sponsors\n\nSpecial thanks to friends who support this work financially:\n\n[![EvoluData](https://www.evoludata.com/display208)](https://www.evoludata.com)\n\n\n## References\n- [Sitemaps protocol (https://www.sitemaps.org/protocol.html)](https://www.sitemaps.org/protocol.html)\n- [Build Sitemaps (https://support.google.com/webmasters/answer/183668?hl=en)](https://support.google.com/webmasters/answer/183668?hl=en)\n- [News Sitemaps (https://support.google.com/webmasters/answer/74288)](https://support.google.com/webmasters/answer/74288)\n- [Image Sitemaps (https://support.google.com/webmasters/answer/178636)](https://support.google.com/webmasters/answer/178636)\n- [Video Sitemaps (https://support.google.com/webmasters/answer/80471)](https://support.google.com/webmasters/answer/80471)\n- [Mobile (https://developers.google.com/search/mobile-sites/mobile-seo/other-devices)](https://developers.google.com/search/mobile-sites/mobile-seo/other-devices)\n\n\n## License\n[MIT](https://github.com/melbahja/seo/blob/master/LICENSE) Copyright (c) 2019-present Mohamed Elbahja\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbahja%2Fseo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelbahja%2Fseo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelbahja%2Fseo/lists"}