Download the PHP package lukaswhite/sitemap without Composer

On this page you can find all versions of the php package lukaswhite/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

Sitemap

A PHP 7.1+ library for building sitemaps, to be written to various formats; most notably as an XML sitemap.

CircleCI

Installation

Install the package using Composer:

This package requires PHP version 7.1 or greater

Creating a Sitemap

You can also provide the location of the sitemap. This is required for certain formats, such as RSS and Atom.

It's also a good idea to set the date & time that the sitemap was modified; particularly if you're generating a sitemap list:

Adding Pages

To create a page with the minimum information:

You may also provide a title, the date & time the page was last modified, the sitemap priority and/or the change frequency:

The title isn't used for XML sitemaps, but it's required for RSS and Atom sitemaps.

The sitemap priority is a float between 0 and 1, and if it isn't provided then it defaults to 0.5.

There are also some convenience methods for setting the page frequency:

Creating an XML Sitemap

Once you've created your sitemap programmatically, the most common scenario is probably to render it as an XML sitemap.

If you want to provide an XSL stylesheet, which means that you can provide it in HTML format if someone visits it in a browser directly, you can do so like this:

You can add any additional processing instructions using addProcessingInstruction( $name, value ).

You may also wish to add comments; for example, you could use this to display aa human-readable indication of when the sitemap was generated, or how it was generated.

Plain-text Sitemaps

A plain-text sitemap is simply a text file, with the URLs that make up the sitemap separated by newlines. They're supported by Google as an alternative to XML sitemaps, although note that information such as the priority and change frequency isn't included by design, so they're rather more limited than XML sitemaps.

RSS Sitemaps

You can also create a sitemap in RSS format.

The RSS writer is pretty limited; You may wish to consider using my feed writer package instead.

You must set the location of the sitemap in order to create a valid feed.

Note that a valid RSS feed requires that the <channel> element includes a title and description, although they aren't really required for sitemaps. Because they are required for the feed to validate, the library outputs some defaults. If you wish, though, you can override these:

Atom Sitemaps

You can also create a sitemap in Atom format.

The Atom writer is pretty limited; You may wish to consider using my feed writer package instead.

You must set the location of the sitemap in order to create a valid feed.

Note that a valid Atom feed requires that the <feed> element includes a title, ID and author, although they aren't really required for sitemaps. Because they are required for the feed to validate, the library outputs some defaults. If you wish, though, you can override these:

You can also set the ID on individual pages using ->setId().

HTML Sitemaps

You can use the HTML writer to generate an HTML-based sitemap.

It's pretty simple; it simply generates an unordered list of links.

Here's an example:

The result:

JSON Sitemaps

JSON isn't a format generally used for sitemaps. However, there are some circumstances in which it might be useful.

For a large application, it might be helpful to be able to inspect a sitemap from an admin panel. One way of doing this is to build a component that displays the current sitemap from a JSON API; that's where this writer might come in.

Custom Writers

You're free to create your own custom writer; simply extend AbstractWriter and implement the write() method.

Getting Data

Alternatively, you may wish to pull data out of the sitemap for manipulation, sorting, or other purposes.

The getPages() method on the Sitemap class returns an array of instances of the Page class. This in turn provides methods such as getUrl(), getTitle(), getPriority() and getChangeFreq().

Splitting Up Large Sitemaps

If your sitemap starts to get very large, you may split it up into separate files. This is done by creating a sitemap list.

Note that in order to create a sitemap, you MUST set the location of the sitemap, for obvious reasons.

You need to create a Sitemap instance in order to craete a sitemap list, but you don't necessarily need to build them fully at the same time, since all the sitemap list includes is the URL and last modified date/time.

Sorting the Sitemap

Most often, the library will probably be used for generating XML sitemaps; in which case the order of the entries makes no difference.

However if you're creating a JSON representation for inspecting in your back-end, or an HTML representation to embed in a page then it might be useful to sort the sitemap; for example by priority.

Extensions

The library supports the following extensions:

Links

The links extension allows you to specify alternate version of pages, either in different languages or for specified locales. For example in Spanish, or in English for British audiences.

You still need to set the URL of a page as normal — this is then the "default" location of the page — and then you can add links as follows:

Images

You can associate one or more images with a page for more effective search engine crawling. an image requires a location (URL), but may also have a title, caption, geo-location and / or a license.

Here's a minimal example:

Here's a more comprehensive example:

Videos

You may also associate one or more videos with a page.

Here is an example that shows most of the available options:

Some notes on the example above:


All versions of sitemap with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.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 lukaswhite/sitemap contains the following files

Loading the files please wait ....